{"_id":"@abibv/kval-dstore","_rev":"2-5ad506c852c9102a13aa5abc4c7432f8","name":"@abibv/kval-dstore","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@abibv/kval-dstore","version":"1.0.0","description":"A simple file based key-value data store that supports basic CRU","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/ABIBV/kval-dstore.git"},"keywords":["Key-value data store","file based data store"],"author":{"name":"ABIBV"},"license":"ISC","bugs":{"url":"https://github.com/ABIBV/kval-dstore/issues"},"homepage":"https://github.com/ABIBV/kval-dstore#readme","dependencies":{"jsonfile":"^6.1.0"},"gitHead":"646ce320d46eddb0493dec9dcf5927d0f8472345","_id":"@abibv/kval-dstore@1.0.0","_nodeVersion":"14.15.3","_npmVersion":"6.14.9","dist":{"integrity":"sha512-E2xmcPJL+7QmrNWnqqTwbEDD1Y9YYOexX29UogSVtprzSE2GurpH7M6w/swCbOx0RNx5ryWoukIF58AHXtGmWA==","shasum":"20f1f2dc730611dfba26883d609b6eb5826b4dc5","tarball":"https://registry.npmjs.org/@abibv/kval-dstore/-/kval-dstore-1.0.0.tgz","fileCount":3,"unpackedSize":7244,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf8GwmCRA9TVsSAnZWagAA43EP/0zlo9CqKhVLHXZm7FTZ\ntg0youapnKfkiK589+sOKg8waNPZxeae1StuKgzNh+wxAZjhh5U4TlWgQf+J\nQqg45QhgzHXM6/A7EncwqVFk2AJ5i02DUhNg60+Vuy1gxKS8dkKV1bDH5zvO\nao9hPFRODrcvnfe8nL7f2RizNgofkjIgyQzqsSkI6G1TNhndOpl+yPDfLBq/\nRp/mslDEp3ugmiXhBY3M/t7B+Qv93m4HJDwOoxRz3uv91xLTUyPbYaQaAp/k\nRWhUGoHmEv9tMUJyGeZOBFRZwuUMujHE+xsPT9sZ1FjbkEOz40MvOFbfeONI\nwEXaIpKdXRtFUJ9JdICI/vc+IPw/OhukXGN9fBJRB/vEX2XbU674nXsAZamK\ndDA5OztRh9yZCsIh/okrBkL2oHF2Xj+wELVy77KCkHI8Pb7blfoNGlVm2GoR\ntOvpO6Oua0ttcQZufXmqYkUzul+EPQSeUSX1Cmr6hS1na+Odb63hYi3tl6FR\neezQNGkaIJmzofhial4qkJUryXc1av9eEzgx11cHSzZ/4XmQTobmOnU63SRR\njxEescW0x4h7PxTV4A+chv2YvuMwhJOtkHRdvro73SuYkFehmRpPcqZfskSx\n9pyK1NkH/GkJeZ8Ub33AXhTlT6Z2rC1GZY6YvJzx+BhAR8QfV3lyuPKMQTPy\niYK8\r\n=1+vl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzKsLiEo7pHxTVaxCPMQCUqX9iIK5Elyx5Hhm3/+3uagIgJ72/ODthZayhyxvHevpimzZUJ4+Fk8Tn1ZQsR9hmg/M="}]},"_npmUser":{"name":"abibv","email":"anandabv1206@gmail.com"},"directories":{},"maintainers":[{"name":"abibv","email":"anandabv1206@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kval-dstore_1.0.0_1609591845541_0.944528227502959"},"_hasShrinkwrap":false},"1.0.1":{"name":"@abibv/kval-dstore","version":"1.0.1","description":"A simple file based key-value data store that supports basic CRU","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/ABIBV/kval-dstore.git"},"keywords":["Key-value data store","file based data store"],"author":{"name":"ABIBV"},"license":"ISC","bugs":{"url":"https://github.com/ABIBV/kval-dstore/issues"},"homepage":"https://github.com/ABIBV/kval-dstore#readme","dependencies":{"jsonfile":"^6.1.0"},"gitHead":"8bd97ba9590f2b15a7ba423adb20b181b97740e6","_id":"@abibv/kval-dstore@1.0.1","_nodeVersion":"14.15.3","_npmVersion":"6.14.9","dist":{"integrity":"sha512-IIBJb6rLARgMOJvBa+LutDqtwrHPYNCRPsgSP7iSKPiy3WrERMw5LStXGfeMV9ZpHyDkMthCdh/Y0Whx/ARj0g==","shasum":"4795ac939fd54c4d7f193c2a3b7da37fe52b7918","tarball":"https://registry.npmjs.org/@abibv/kval-dstore/-/kval-dstore-1.0.1.tgz","fileCount":3,"unpackedSize":7527,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf8IJICRA9TVsSAnZWagAAP5AP/R8+8FCdKRveYg11KDgC\nRPRxc0+m2L04N0AWQ7crfGm9pmU1ckkdH9qVBjFOwlb6o0BiINOF/5xMl2Ab\nBl7lXypF8fSUcDyYQTeyz/rT9KajL0ZH8u93K/0XU0zxLTWgpCFXwsb2M57b\noTG/c+pJKKgvR1jyMiN+KUZ81/OIbUE/TtkOcqEp23ucnmjs2tWEAgghdfOA\n4wbtuUgbUmFGsT02FQHDygLP5w8cfmSLM142sTKtnS8IALczzOB4K4gB8MYQ\nV9+CKFgFH2/x7IQJp4arMlYd3K5qjtIdcoTl2eunulovhdFwyMWBTtNiksM1\nVdZTvkwFdJsYsDWZgyYN6hNP5VN/oHhXupOnbiO4VPgNvgaLyZeLNOYnqmo9\npDqpaY2V+mpUnQ2J6kw7mEDtnmuxUP30MWI/9qdDZZoutgt91kJhX0Ra0d/I\nrR5PYNCwjYfg7Wkj9sryU8XHCA1db2cIj6h9fTfsUjq/bJmtON8/nB8tbBxB\n+vvel5OHHM2NWd+fbzq4pely8s/JhPC/SgjPLHuAOGwLfcXIglTmEc4zIdGM\nYTEvQjqHzxieXBuxLNZne8wqmeT9l+8icI486IyjezHsvrf++tI5vvEz8AA9\nlO+OJNh06H6wFkdel+u/ym5RQA3A+KfGR4OaeNlzQqFYR+7QYhpAaTATLaUD\nDTJ/\r\n=Y16P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC5KgNzueKF5TlIRgi6QJMkVJYa274R0oeWIUqZY+Nk+QIgL7+5T2SkjvZGdfbU9HhMQ3x7viEg3c+bF3BmSEzvCGA="}]},"_npmUser":{"name":"abibv","email":"anandabv1206@gmail.com"},"directories":{},"maintainers":[{"name":"abibv","email":"anandabv1206@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kval-dstore_1.0.1_1609597511664_0.5320361260042208"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-02T12:50:45.503Z","1.0.0":"2021-01-02T12:50:45.718Z","modified":"2022-04-04T10:59:30.051Z","1.0.1":"2021-01-02T14:25:11.802Z"},"maintainers":[{"name":"abibv","email":"anandabv1206@gmail.com"}],"description":"A simple file based key-value data store that supports basic CRU","homepage":"https://github.com/ABIBV/kval-dstore#readme","keywords":["Key-value data store","file based data store"],"repository":{"type":"git","url":"git+https://github.com/ABIBV/kval-dstore.git"},"author":{"name":"ABIBV"},"bugs":{"url":"https://github.com/ABIBV/kval-dstore/issues"},"license":"ISC","readme":"# kval-dstore\nA simple file based key-value data store that supports basic CRUD operations in nodejs.\n\nIt creates a json file that can be used as a key-value database for learning purpose or even for micro-apps.\n\nIt provides five different API for accessing the key-value data store.\n\n* [write(object [,path])](#write-the-data)\n* [read([path])](#read-the-data)\n* [update(data, key [,path])](#update-the-data)\n* [delete([path])](#delete-a-data)\n* [calcFileSize()](#calculate-data-store-size)\n\n\n## **Initializing data store**\n\n`new dstore(filename [,sizeLimit, initData]);`\n\n* **filename (String)** - The file name with its path for the json file.\n* **[optional] sizeLimit (String)** - Specifies the sizeLimit in MegaByte *(default is 1024 MB)*\n* **[optional] initData (JSON object)** - Initial data to be stored at the time of file creation *(default is empty json object **{}**)*\n\n\n```\nconst dstore = require('@abibv/kval-dstore');\n\nconst store = new dstore('./dstore.json');\n(or)\nconst store = new dstore(__dirname + '/dstore.json');\n```\n\n## **Write the data**\n\n`store.write(object [,path]);`\n\n* **object (JSON object)** - Data to be stored. \n* **[optional] path (string)** - Key path where the data should be placed (**should be referred from the root**) *(default is the root of the json data **'/'**)* \n\n`write` is an **Asynchronous method** which returns nothing.\n\n```\nvar object = {\n  name: 'myname',\n  no: 123456789,\n  timeSpent: {\n    tech: '50%',\n    music: '30%',\n    sleep: '20%',\n  }\n};\n\n\n//Write the data at the root\n\nstore.write(object)\n  .then(() => { console.log('data written'); })\n  .catch((error) => { console.log(error); });\n\n\n//Write the data at the specified \n\nstore.write(object, '/department/year/students/')\n  .then(() => { console.log('data written'); })\n  .catch((error) => { console.log(error); });\n```\n\n## **Read the data**\n\n`store.read([path]);`\n\n* **[optional] path (String)** - JSON key path from where the data should be read. *(default is root **'/'**)*\n\n**If the path is not specified, then the whole data was read.**\n\n`read` is an **Asynchronous method** which returns the data read.\n\n```\nstore.read('/department/year/students/')\n  .then((data) => { console.log(data); })\n  .catch((error) => { console.log(error); });\n```\n\n## **Update the data**\n\n`store.update(data, key [,path]);`\n\n* **data (any)** -  data to be updated.\n* **key (String)** - JSON key whose value should be replaced *(must be a Single key string)*.\n* **[optional] path (String)** - path of the key in the JSON object referred from the root **'/'**.\n\n`update` is an **Asynchronous method** which returns nothing.\n\n```\nstore.update({ misc: '10%' }, '/timeSpent')\n  .then(() => { console.log('updated'); })\n  .catch((err) => { console.log(err); });\n```\n\n## **Delete a Data**\n`store.delete([path])`\n\n* **[optional] path (String path)** - JSON key path from where the key-value pair should be deleted *(default is root **'/'**)*\n\n**If no path is specified, then the whole data store with the file will be deleted**\n\n`delete` is an **Asynchronous method** which returns nothing.\n\n```\nstore.delete('/timeSpent')\n  .then(() => { console.log('timeSpent object deleted'); })\n  .catch((error) => { console.log(error); });\n```\n\n## **Calculate data store size**\n\n`store.calcFileSize()` \n\n`calcFileSize` is an **Synchronous method** which returns the size of the data store file in MegaBytes.\n\n```\n console.log(store.calcFileSize());\n```","readmeFilename":"README.md"}