https://github.com/shahradelahi/storage-box
💾 A Memory-based key-value storage system for JavaScript.
https://github.com/shahradelahi/storage-box
browser database key-value nodejs storage
Last synced: about 1 year ago
JSON representation
💾 A Memory-based key-value storage system for JavaScript.
- Host: GitHub
- URL: https://github.com/shahradelahi/storage-box
- Owner: shahradelahi
- License: mit
- Created: 2023-12-27T15:48:53.000Z (over 2 years ago)
- Default Branch: canary
- Last Pushed: 2025-05-12T17:10:03.000Z (about 1 year ago)
- Last Synced: 2025-05-14T00:41:53.313Z (about 1 year ago)
- Topics: browser, database, key-value, nodejs, storage
- Language: TypeScript
- Homepage: https://npmjs.com/storage-box
- Size: 193 KB
- Stars: 446
- Watchers: 3
- Forks: 9
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
StorageBox
_storage-box_ is a JavaScript library designed for the purpose of storing data in various structures across multiple
storage systems. The primary goal of this library is to offer a straightforward and effective method for data storage.
## 👀 Features
- Simple API
- Support for **Node.js**, **Bun** and the **browser**
- Support for multiple storage types (Memory, File, Browser-storage, etc.)
- Multiple data structures (Literals, Hashes, Lists, etc.)
- Time-based key expiration
## ⚙️ Installation
```bash
npm i storage-box
```
## 📖 Usage
```typescript
import { Client } from 'storage-box';
const client = new Client();
client.setex('key', 'value', 2);
console.log(client.get('key')); // value
// time to live in milliseconds
console.log(client.ttl('key', true)); // 2000
// after 3 seconds
setTimeout(() => {
console.log(client.get('key')); // undefined
}, 3e3);
```
## 📦 Storage Types
- Memory ([Docs](docs/driver-memory.md)) (default)
- File-based (Fs) ([Docs](docs/driver-fs.md))
- Local/Session Storage ([Docs](docs/driver-browser.md))
## 📚 Documentation
For all configuration options, please see [the API docs](https://paka.dev/npm/storage-box/api).
## 🤝 Contributing
You can contribute to this project by opening an issue or a pull request
on [GitHub](https://github.com/shahradelahi/storage-box). Feel free to contribute, we care about your ideas and
suggestions.
## Project Stats

## License
[MIT](/LICENSE) © [Shahrad Elahi](https://github.com/shahradelahi)