New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

diskstore

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diskstore

a local cache implement

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

diskstore

a basic local cache implementation

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Introduction

A basic file cache implementation. It just providers low-level APIs (get, set, delete) to allow you read & atomic write from file cache. You can also create your implementation by inheriting or wrapping it.

Install

$ npm install diskstore --save

APIs

  • new DiskStore(options)
    • {String} cacheDir - root cache dir
  • * get(relativePath) read data from relativePath if the file exists.
    • {String} relativePath - file path relative to root cache dir
  • * set(relativePath, data) write data to relativePath
    • {String} relativePath - file path relative to root cache dir
    • {Buffer|String} data - the data
  • * delete(relativePath) delete the file
    • {String} relativePath - file path relative to root cache dir

Usage

const diskStore = new DiskStore({
  cacheDir: '/path/cache',
});
yield diskStore.set('a/b/c', 'c');
let data = yield diskStore.get('a/b/c');
assert.deepEqual(data, new Buffer('c'));

yield diskStore.delete('a/b/c');
data = yield diskStore.get('a/b/c');
assert(data === null);

License

MIT

Keywords

FAQs

Package last updated on 23 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc