node-fs-storage
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

node-fs-storage

GitHub Actions Codecov Codacy Grade type-coverage npm GitHub Release

David Peer David David Dev

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier changesets

File System Storage shared same interface with Browser Storage.

TOC

Usage

Install

yarn add node-fs-storage    # yarn
npm install node-fs-storage # npm

API

// default
import { fsStorage } from 'node-fs-storage'

fsStorage.setItem('key', 'value')
fsStorage.getItem('key')
fsStorage.key(0)
fsStorage.length
fsStorage.removeItem('key')
fsStorage.clear()
// custom
import { FsStorage } from 'node-fs-storage'

// custom path
const fsStorage1 = new FsStorage(path.resolve('.storage'))

// custom `path` and key `encoder`, make sure it is a valid filename
const fsStorage2 = new FsStorage({
  path: path.resolve('.storage'),
  encoder: hash(key),
})

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT © JounQin@1stG.me

Package Sidebar

Install

npm i node-fs-storage

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

17.4 kB

Total Files

8

Last publish

Collaborators

  • i1stg