# local-file-storage

> saves data locally

Latest version **1.0.1** (published 2020-12-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install local-file-storage
pnpm add local-file-storage
yarn add local-file-storage
bun add local-file-storage
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-12-31 |
| First published | 2020-12-31 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Saumya Jain |
| Maintainers | saumyaaajain |
| Keywords | File Storage |

## Links

- npm: https://www.npmjs.com/package/local-file-storage
- Repository: https://github.com/saumyaaajain/json-to-file
- Homepage: https://github.com/saumyaaajain/json-to-file#readme
- Issues: https://github.com/saumyaaajain/json-to-file/issues
- npm.io page: https://npm.io/package/local-file-storage

## Dependencies (1)

- [lockfile](https://npm.io/package/lockfile.md) ^1.0.4

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-12-31
- 1.0.0 — 2020-12-31

## README

# Local File Storage
This library stores all your data locally in a file. Create, Read and Delete (CRD) operations can be performed with the data stored. Each record has a TimeToLive property which signifies it's' time to live, post which it is no longer available for operations.

## Installation
`npm i local-file-storage`

## Examples
`const LocalFileStorage = require('local-file-storage');` <br/>
`const file = new LocalFileStorage();` <br/>
 `const file = new LocalFileStorage(['filename']);`
 
 If no file name is provided, the data would be stored in "FileStorage.txt".
 
### Create
`file.create(key, value, [timeToLive]);` 

It expects key in the form of string, value in the form of JSON and time to live in the form of integer <br/>
If the key is already present, it will throw an error.

### Read
`file.get(key);`

returns JSON value associated with the key

### Delete
`file.delete(key);`

---
_Source: https://npm.io/package/local-file-storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
