{"_id":"fs-memory-store","_rev":"469004","name":"fs-memory-store","description":"Filesystem store with in-memory cache","dist-tags":{"latest":"0.2.0"},"maintainers":[{"name":"twolfson","email":"todd@twolfson.com"}],"time":{"modified":"2021-08-05T08:11:02.000Z","created":"2014-04-13T22:34:36.858Z","0.2.0":"2015-02-09T06:56:31.884Z","0.1.1":"2015-02-09T06:53:15.388Z","0.1.0":"2014-04-13T22:34:36.858Z"},"users":{},"author":{"name":"Todd Wolfson","email":"todd@twolfson.com","url":"http://twolfson.com/"},"repository":{"type":"git","url":"git://github.com/twolfson/fs-memory-store.git"},"versions":{"0.2.0":{"name":"fs-memory-store","description":"Filesystem store with in-memory cache","version":"0.2.0","homepage":"https://github.com/twolfson/fs-memory-store","author":{"name":"Todd Wolfson","email":"todd@twolfson.com","url":"http://twolfson.com/"},"repository":{"type":"git","url":"git://github.com/twolfson/fs-memory-store.git"},"bugs":{"url":"https://github.com/twolfson/fs-memory-store/issues"},"licenses":[{"type":"MIT","url":"https://github.com/twolfson/fs-memory-store/blob/master/LICENSE-MIT"}],"main":"lib/fs-memory-store","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha"},"dependencies":{"clone":"~0.1.11","mkdirp":"~0.3.5"},"devDependencies":{"mocha":"~1.11.0","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.0","grunt-contrib-watch":"~0.4.0","mocha-fixture-dir":"~0.1.0","fixture-dir":"~0.1.0","chai":"~1.9.1","obj-extend":"~0.1.0"},"keywords":["fs","memory","store","cache","filesystem","disk"],"gitHead":"2f3b6e336097ec1d5f1a29c4ecbed70fbece1032","_id":"fs-memory-store@0.2.0","_shasum":"db4883fe912b0397e64e6b4017a1dd693eae8311","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.35","_npmUser":{"name":"twolfson","email":"todd@twolfson.com"},"maintainers":[{"name":"twolfson","email":"todd@twolfson.com"}],"dist":{"shasum":"db4883fe912b0397e64e6b4017a1dd693eae8311","size":5366,"noattachment":false,"key":"/fs-memory-store/-/fs-memory-store-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/fs-memory-store/download/fs-memory-store-0.2.0.tgz"},"directories":{},"publish_time":1423464991884,"_cnpm_publish_time":1423464991884,"_hasShrinkwrap":false},"0.1.1":{"name":"fs-memory-store","description":"Filesystem store with in-memory cache","version":"0.1.1","homepage":"https://github.com/twolfson/fs-memory-store","author":{"name":"Todd Wolfson","email":"todd@twolfson.com","url":"http://twolfson.com/"},"repository":{"type":"git","url":"git://github.com/twolfson/fs-memory-store.git"},"bugs":{"url":"https://github.com/twolfson/fs-memory-store/issues"},"licenses":[{"type":"MIT","url":"https://github.com/twolfson/fs-memory-store/blob/master/LICENSE-MIT"}],"main":"lib/fs-memory-store","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha"},"dependencies":{"clone":"~0.1.11","mkdirp":"~0.3.5"},"devDependencies":{"mocha":"~1.11.0","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.0","grunt-contrib-watch":"~0.4.0","mocha-fixture-dir":"~0.1.0","fixture-dir":"~0.1.0","chai":"~1.9.1","obj-extend":"~0.1.0"},"keywords":["fs","memory","store","cache","filesystem","disk"],"gitHead":"5a5be33c2997738678379933ddfd8c2aee52159c","_id":"fs-memory-store@0.1.1","_shasum":"d0cc0238cba5f48b58df1cc6e2ddf5f9f151ee86","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.35","_npmUser":{"name":"twolfson","email":"todd@twolfson.com"},"maintainers":[{"name":"twolfson","email":"todd@twolfson.com"}],"dist":{"shasum":"d0cc0238cba5f48b58df1cc6e2ddf5f9f151ee86","size":5177,"noattachment":false,"key":"/fs-memory-store/-/fs-memory-store-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/fs-memory-store/download/fs-memory-store-0.1.1.tgz"},"directories":{},"publish_time":1423464795388,"_cnpm_publish_time":1423464795388,"_hasShrinkwrap":false},"0.1.0":{"name":"fs-memory-store","description":"Filesystem store with in-memory cache","version":"0.1.0","homepage":"https://github.com/twolfson/fs-memory-store","author":{"name":"Todd Wolfson","email":"todd@twolfson.com","url":"http://twolfson.com/"},"repository":{"type":"git","url":"git://github.com/twolfson/fs-memory-store.git"},"bugs":{"url":"https://github.com/twolfson/fs-memory-store/issues"},"licenses":[{"type":"MIT","url":"https://github.com/twolfson/fs-memory-store/blob/master/LICENSE-MIT"}],"main":"lib/fs-memory-store","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha"},"dependencies":{"clone":"~0.1.11","mkdirp":"~0.3.5"},"devDependencies":{"mocha":"~1.11.0","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.0","grunt-contrib-watch":"~0.4.0","mocha-fixture-dir":"~0.1.0","fixture-dir":"~0.1.0","chai":"~1.9.1","obj-extend":"~0.1.0"},"keywords":["fs","memory","store","cache","filesystem","disk"],"_id":"fs-memory-store@0.1.0","dist":{"shasum":"50ef0aae11846e9a2939bd50cabbc2b5c3ce2c7f","size":5097,"noattachment":false,"key":"/fs-memory-store/-/fs-memory-store-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/fs-memory-store/download/fs-memory-store-0.1.0.tgz"},"_from":".","_npmVersion":"1.4.2","_npmUser":{"name":"twolfson","email":"todd@twolfson.com"},"maintainers":[{"name":"twolfson","email":"todd@twolfson.com"}],"directories":{},"publish_time":1397428476858,"_cnpm_publish_time":1397428476858,"_hasShrinkwrap":false}},"readme":"# fs-memory-store [![Build status](https://travis-ci.org/twolfson/fs-memory-store.png?branch=master)](https://travis-ci.org/twolfson/fs-memory-store)\n\nFilesystem store with in-memory cache\n\nThis was built for usage with [`eight-track`][], an HTTP fixture library. It is designed for ease-of-access while debugging. By default, items will be stored to separate `.json` files in the folder.\n\n[`eight-track`]: https://github.com/uber/eight-track\n\n## Getting Started\nInstall the module with: `npm install fs-memory-store`\n\n```js\n// Generate a store inside of `http-fixtures`\nvar Store = require('fs-memory-store');\nvar store = new Store(__dirname + '/http-fixtures');\n\n// Save a value\nstore.set('hello', {world: true}, function (err) {\n  // If there was an error, `err` will be it\n\n  // We have created `http-fixtures/hello.json`\n  /*\n  {\n    \"world\": true\n  }\n  */\n\n  // Load the value\n  store.get('hello', function (err, val) {\n    // If there was an error, `err` will be it\n    // Log our value\n    console.log(val); /* {world: true} */\n  });\n\n  // Load an non-existent value\n  store.get('wat', function (err, val) {\n    // If there was an error, `err` will be it\n    // Log our value\n    console.log(val); /* null */\n  });\n});\n```\n\n## Documentation\n`fs-memory-store` returns `Store` as its `module.exports`.\n\n### `Store(dir, options)`\nConstructor for a new store\n\n- dir `String`, Directory to generate our store inside of\n- options `Object`, Container for options/flags\n    - ext `String`, Extension to save values under. By default, this is `.json`\n    - stringify `Function`, Stringifier to pass values through when saving to disk\n        - By default, this is `JSON.stringify` with an indenation of 2\n    - parse `Function`, Parser to pass values through when loading from disk\n        - By default, this is `JSON.parse`\n\n#### `Store#get(key, cb)`\nRetrieve an item from memory with a fallback to disk.\n\n- key `String`, Identifier to retrieve item by\n- cb `Function`, Error-first callback function to receive item value\n    - Signature should be `(err, val)`\n    - err `Error|null`, If there was an error, this will be it\n    - val `Mixed|null`, If the value was found, this will be it. If it was not found, this will be `null`.\n\n#### `Store#set(key, val, cb)`\nSave an item to memory and disk\n\n- key `String`, Identifier to save item under\n- val `Mixed`, Value to save under the `key`\n- cb `Function`, Error-first callback function to handle errors\n    - Signature should be `(err)`\n    - err `Error|null`, If there was an error, this will be it\n\n#### `Store#delete(key, cb)`\nDelete an item from memory and disk\n\n- key `String`, Identifier to delete item under\n- cb `Function`, Error-first callback function to handle errors\n    - Signature should be `(err)`\n    - err `Error|null`, If there was an error, this will be it\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via [grunt](https://github.com/gruntjs/grunt) and test via `npm test`.\n\n## Donating\nSupport this project and [others by twolfson][gittip] via [gittip][].\n\n[![Support via Gittip][gittip-badge]][gittip]\n\n[gittip-badge]: https://rawgithub.com/twolfson/gittip-badge/master/dist/gittip.png\n[gittip]: https://www.gittip.com/twolfson/\n\n## License\nCopyright (c) 2014 Todd Wolfson\n\nLicensed under the MIT license.\n","_attachments":{},"homepage":"https://github.com/twolfson/fs-memory-store","bugs":{"url":"https://github.com/twolfson/fs-memory-store/issues"}}