https://github.com/unix/store-now
File store
https://github.com/unix/store-now
command-line-storage file-storage file-store
Last synced: 9 months ago
JSON representation
File store
- Host: GitHub
- URL: https://github.com/unix/store-now
- Owner: unix
- License: mit
- Created: 2019-06-10T08:21:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T23:48:14.000Z (almost 3 years ago)
- Last Synced: 2025-04-06T06:39:34.855Z (9 months ago)
- Topics: command-line-storage, file-storage, file-store
- Language: TypeScript
- Homepage:
- Size: 477 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## store-now
Use file store in NodeJS (projects suitable for command-line tools).
In the project of command line tools, i rewrite config storage every time, this project may help you with the same problem.
## Feature
- **Small**: no dependencies, no libs
- **Easy**: no learning cost
- **Safe**: contain tests
- **Support**: `Promise` / `async / await` / Multiple Stores / Multiple Systems
## Usage
Store file writing location is related to the operate system, in `macos`, the path is `/Users/${user}`.
1. install: `npm i store-now`
2. import and create project:
```js
import { Store } from 'store-now'
const store = new Store('my_project')
```
## API
> `store-now` contain type files, and in most cases you can get prompts.
- `store.save(key: string, value: any)`: save an object or string or number.
- `store.find(key: string)`: find a value.
- `store.findAll()`: find all values.
- `store.has(key: string)`: check whether the key exists.
- `store.clear()`: clear all.
e.g.
```js
import { Store } from 'store-now'
// create project
const store = new Store('my_project')
// save value
await store.save('user', { name: 'witt' })
// get value
const user = await store.find('user')
```
## LICENSE
[MIT](./LICENSE)