https://github.com/jjosh102/obaki-local-storage
obaki-local-storage is a lightweight utility for efficient data caching and retrieval, designed to optimize performance by minimizing unnecessary network requests.
https://github.com/jjosh102/obaki-local-storage
npm-package show typescript
Last synced: 3 months ago
JSON representation
obaki-local-storage is a lightweight utility for efficient data caching and retrieval, designed to optimize performance by minimizing unnecessary network requests.
- Host: GitHub
- URL: https://github.com/jjosh102/obaki-local-storage
- Owner: jjosh102
- Created: 2024-03-04T13:48:36.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-04T14:37:38.000Z (over 2 years ago)
- Last Synced: 2025-09-19T18:31:54.883Z (11 months ago)
- Topics: npm-package, show, typescript
- Language: TypeScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# obaki-local-storage
[](https://www.npmjs.com/package/obaki-local-storage)
`obaki-local-storage` is a lightweight utility for efficient data caching and retrieval, designed to optimize performance by minimizing unnecessary network requests.
## Installation
Install the package via npm:
```bash
npm install obaki-local-storage
```
## Usage
`getCacheData`
```typescript
import { getCacheData } from 'obaki-local-storage';
// Define your fetch data function
const fetchDataFunction = async () => {
// Implement your data fetching logic here
// ...
return /* fresh data */;
};
// Example usage for getCacheData
const cachedData = await getCacheData('my-cache-key', fetchDataFunction);
console.log('Cached Data:', cachedData);
```
`getEncryptedCacheData`
```typescript
import { getEncryptedCacheData } from 'obaki-local-storage';
// Define your fetch data function
const fetchDataFunction = async () => {
// Implement your data fetching logic here
// ...
return /* fresh data */;
};
// Set your encryption key
const encryptionKey = 'your-secret-key';
// Example usage for getEncryptedCacheData
const encryptedData = await getEncryptedCacheData('my-encrypted-cache-key', fetchDataFunction, encryptionKey);
console.log('Encrypted Data:', encryptedData);
```
`getEncryptedData`
```typescript
import { getEncryptedData } from 'obaki-local-storage';
const key = 'myEncryptedDataKey';
const encryptionKey = 'SuperSecretKey';
// Retrieve and decrypt data
const decryptedData = getEncryptedData(key, encryptionKey);
console.log('Decrypted Data:', decryptedData);
```
`setEncryptedData`
```typescript
import { setEncryptedData } from 'obaki-local-storage';
const key = 'myEncryptedDataKey';
const encryptionKey = 'SuperSecretKey';
const dataToStore = ['confidential', 'information'];
// Encrypt and store data
setEncryptedData(key, dataToStore, encryptionKey);
console.log('Data encrypted and stored successfully.');
```