{"_id":"ipfs-repo-ci-test","_rev":"40-51b9541979205e5f87bf07b0bb4a3b2f","name":"ipfs-repo-ci-test","dist-tags":{"next":"0.46.14-1","latest":"0.46.13"},"versions":{"0.24.1-rc.0":{"name":"ipfs-repo-ci-test","version":"0.24.1-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"2598b95ac5d1eb2aab16887c41678243d9ebc389","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.1-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-rdJDkC7972AzpMU8+FgxQYDWCq6yk6NXBAbx4g/WJpjl0TSEuFORtHhkaoOR2YBkqJ8Fbq8R6wkYHmQPh6VL6Q==","shasum":"6a1d73926d9edd5a3d60b2d3bc2dd5168c67267a","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.1-rc.0.tgz","fileCount":28,"unpackedSize":2299354,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx13mCRA9TVsSAnZWagAAPLYP/0gWGxJZg253odmoQOAB\nvS44z84rtBf17FMJJY+zBYBvfCkLDmX/E/oAJjQQyUkU03DL9SHWb9n680rK\nsJ6VAe1eA+aONER7Kt2X7+DlBVa2dJMUIwn3a1eCt67il9ZJ89TIkdIf11Uz\nhYcnSQGSzlLXj2J0hJEZGwZRQlvblBBYoDigmvh/opAPharB5cGh8/iRXTPm\n3zZC9CqjCENXg6Lej68aWLlk1potOmQHGK2+p1ldPOJuxqeG0CRdGkDEtHiY\n2Iz8pe0uOrZIXd8rFrDrgEp50BD666wEDF7EkfI0B921j8ZNMw/XAwLNI0vJ\nQrO1QrL+/7xIVmyPErYuoYBbD/WOZrEPLooaLixyb5NznWhU71mYT/Quyr4c\nZIFBaBnC/Cb0x8f9kZmqaPovFAzJET5BjKCo2sRVxBAx7Oy9T4MlS1O5rx99\nsTUv9YlebWcsbYNoDv7TcMDUDIX2vRIul64jhdoSH2s08KYKGP0DDN896H1L\nbbMWQh62mxV+f19Wnh/B5y0zDvZG/zS8G4/yEmH0rYIyEGny3bACYi80i3Cv\nz/yxA6/J1il3BfMJ/Q7TMTF/IOBn55XSpQth+hiVgpQNLFXwWQcKpegMpHls\n4XEeuoZzD6p8jeZnmckisjLjS3UwseWL6gcQ5TfMX83LhIzP/6zCGumoDnG1\nKKzm\r\n=ciuE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGT1Jd0rcZxXppTSRW5lOB27pFBLQ3ZvpvrIc31q0ui9AiEA0O6lCpmS5jqzNENAo84cuiGdMdSI02YCYTM5K+BvEys="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.1-rc.0_1539792357471_0.6109748990238586"},"_hasShrinkwrap":false},"0.24.1":{"name":"ipfs-repo-ci-test","version":"0.24.1","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"660e42bd27778ac80e2a5328ab7ebc54a2270832","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.1","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-sHL/nh5z8c+uZNDHAvvTMnOGTE3hQdMrvP56ffhAKOenT2v0FfFbo/U+axeC3l6C8Xt66h0p0jhzBnL4uvIflQ==","shasum":"9a17568af0c0e2c29a3bdc61105c6d0856f1bc3b","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.1.tgz","fileCount":28,"unpackedSize":2299349,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx17pCRA9TVsSAnZWagAAqWkP+gJgbpm/t+BkQJ7wR2BV\n8mFmlxT4BmRx6OjKUwDutW8OERsP9MdlkObzXr10oBhHoVCU/boCQAOakcQM\nJ+si8BvhXH5oMThLUB+43pfT6omLO6fWI+eJJnPvR78uc7+uzowVDHs7mrF7\n5NbOt2j5CVDwr1OWN/9/v6jb65xzLRcwDbfGvyfwTTIuW8oM18dUNqgReoad\nIcbTm0SzUaYn5kOiqyFVnMpfVs2BijREcTbBCmrnkfU4It6RmkFJ3xqhg2xi\nDsg3QduQEvTl0tLl105z4T3QKCPUKbMvVgb+qUlzdJCH2WpKW6ZQxjE2dWW1\nn8NfmNJ1mwGfWiEAL46qv2gdy8JEiGLv0Cb6Ec5a/N/gJRCnxL1uyZN/mBMM\n2k6sxzHI85GHhDv3Y3aM2Sta0YlO4KY256O9lBizE5g935P2tEmFazKxhoRr\n5evEvd6jCnuqipQAiEjVdhRmv9mqENeTgUDMze7nZlgIBbkuuctid/KZV+mF\nidH78jWXtBxeDAjVEIVFzfYj7s4WE7ncu/UAqE70nRvAVtqRZAQ9gb64vhjA\nxf9yVgdDU9BApDpImC/ox7OlxXIcs3OuqMS29QWODy+2F/a8eQE3hgm9VKP4\nJ0Gf4ur1zDYJtqkcjiHN08LlV1O7lwvI1JcHwmof1Kc8wz3dyK3DzdCcaQjA\nDTpw\r\n=th7f\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDoUFHtpHyQzuEFVIfU87H1f/iyk5nAPmJxVmp+0FqA9AIhAPd+cbLU7TOVnfsNt4Uszatw25pEpldjkgfYCQhtwR4D"}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.1_1539792616755_0.5730147395257881"},"_hasShrinkwrap":false},"0.24.4-rc.0":{"name":"ipfs-repo-ci-test","version":"0.24.4-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"faccb610165741fd89ca921587e98a47e395bcc9","readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## TESTING 2\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.4-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-V78kdeOWyE1NVRNrNnzZ9CeoUEeBl2vCZFITKsA2/hIhx3nNQ7L/Ez+yuhfRWyvuvSTnDv/7+RZRqKij1VY83A==","shasum":"667e310c2b67c71c740203fe24e4d1ab9aeac35b","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.4-rc.0.tgz","fileCount":28,"unpackedSize":2299867,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx2NvCRA9TVsSAnZWagAAPxEQAJoUOf7skUPT+UbfleRr\nh9pZHlbYNzCt4c5hyH4x0dg85cVfuGZY3GJBtd7A3rtCcTymTohgveJl6yAA\n/FZ9lOIgr4lVdhdsGkA53ETxbFcZAtyhA1c/hIHraFMJ34/9DcNpRv2yE3h2\nqNEZuG8LwT1Myuie+PpNfGQT7TdHUopevHOIcHDfRrRq1Mv2HcNXzZUk6pkz\nGeJQpT3Xbsds6/4ndSHoezUlctdutVUC5KKOKXR888dTnXH2Akag+um0Uys8\nuWvbiU7PCIDiq4KFx8/Yn0XarftyWzwUYdM86Q8Bl/EjJCF+fwcvQbcuaFeG\nvHlVqQGyV3Y3ExjapXsKX2500pGeb/JbpshscRinpTawgXhcE5MOIeoMt3cL\nFxaIx5ZCvY0nW5a9hnQQeoFPnnKqvx42v5/MGHOKBwQv7CJb+d8skVS0qV6X\nY+kVNsvPl++8TP7jjfPhcrmlByoD7FWetYppyN9ZlghsAMaUzWKR05L5TAWG\nAefXV+96HW2JKkWmZpfnD5ubx0MZH7XO+gY48JLMWsQn9gl715v1cD3/dx3m\ncMeD2/Vch1kMu0S2Dbio1a0imJfsGg8+ibwBQvQjbUE2Ta/4umOooxa9tY8R\n2kVCrf95A0ktmZszU75EuTcHRRaANFxGLNzKWgkx0PpmHVr7Gl4FUtrdaufP\nBXG4\r\n=vH/a\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFe9IZY8BgmsyneMJm4t72iRKo2qQZI8OTUjUuHKmQ8UAiAOVBFM8vtzZ1gngxNMm+euhFTqMbz6r55l4Sngra9pug=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.4-rc.0_1539793774361_0.7450112542637808"},"_hasShrinkwrap":false},"0.24.4-rc.7":{"name":"ipfs-repo-ci-test","version":"0.24.4-rc.7","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## TESTING 22fff\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"c799a61f4aa97c1c6392f528c48ef95c384b3672","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.4-rc.7","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-CVv45d2qmnsLTbBKvZ9CFbB2BbLPM8ZzuTkSHr2JyMj0RoVyJluC5+hBVx3KbBVRp976HYq/sr9SfVxeEGB+Iw==","shasum":"7bfe74edb87ac9cf9491ae1ed14da1066d0162fc","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.4-rc.7.tgz","fileCount":28,"unpackedSize":2299871,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx2k5CRA9TVsSAnZWagAALM0P/iIuxBTV7XZQsovgRdJ0\nu6jBsBzdAeXkOULwADhaHQK86IKrzkTndoBAZJVb2uu76sP5Ef3pqWvVo/4L\nBMaJ6cDIfwU66xOSBqJTzFjbruF53wzWGY0maxjq8eaKBsjM4LkUcQNZP9/E\nA3KaODoKi6DyfDe3DE8ch0pEpOMJe+E/EA2kJ3/4xayewvb6Do2S8t/ur8y1\nZ5ZFcnlKQ2+Wv0Y3BOO/bHS79Rar6vTI4SsXHiNqrgdqDZ5gYzdxYTAbh94B\n3Qn4Nnkq/6NmQHcsFIBlkFC48Az/E7W9ixhkEFNHwV6n3wGz8zM1U4qDUBc5\nkZ+9Y/6zqJ2QrQs8+rchAj+lC6mq0AfUGR01Zmeyzygzi3f/P9+dww/0FrkQ\nUCy/Su1miTkKouagsYHBE7HKTj+mD2dNwnJjOov9L/AI6Ru9wyFG52NM5xf4\nlIdgKEtj4ZPsyWO2xdybevWuwM0j/g+3zrkfuhOmI8luSTW0oIT+8655Gx+y\n1XD5KX0g2pdkNJggVsZTGHPRmu/Y+tBp6aDS/orJ3cUmsRV8otC8BoDod+nG\n4xqhH/8Y/AsuBjEqr0WZaw+1YskLhP7ozmlJpaZvKaq/xWhVGtMslWtvqFrX\nwNna7Dxd0zyrZmXeX3RLY/jb1iYNlpzqKzky3zoBq6umLztqe/XUv9JJ4k26\n/B3g\r\n=hATC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEaAoceGF+updGyGEUBc/RC2nmlUZAAYTKKORlQ4QqMdAiBSvcTilUZ/78eRJRrfUQkCHAYSQIeE3urGQ8qxRg2akg=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.4-rc.7_1539795257357_0.756028034958401"},"_hasShrinkwrap":false},"0.24.4-rc.8":{"name":"ipfs-repo-ci-test","version":"0.24.4-rc.8","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## TESTING 22fff\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"e30f1537e9e0512f2d879d20a6334f67b6023b57","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.4-rc.8","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-IvVzMaNwkkHZ1ksQMCzcnMwche4maTGWQdgei5qIpiGszj+sy4rPi5f2bm7QF3yerOTAcJRWH6eG7MloPqU6pg==","shasum":"7f968fd18f19a66268b7933a117c633f4174285d","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.4-rc.8.tgz","fileCount":22,"unpackedSize":2290529,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx4uJCRA9TVsSAnZWagAA0YkP/2NzctfwEsyVCwcIpSDf\n2JoRxgVvvlWRG66OFvchgm56Q5IGRCzqIWCXP/SiSQM0EU2c/FPHnzYgEBMm\nrPtFMHaNipavsN9aNwvwWZMAxFikhN3F9zxV+Vb3y/UaFVizn/y7lokcgPNg\nV2kAG2YkhVa7yEFDnD4b3k0M+ZFfvCdAzVp7TWK4EI0T2FjH6s3XMrgwFw25\nAZNqGmibqroByJncPTcEyg680gL1c4JkA+tbsNN9e6X+GNkuqwRKtN+Cunn4\nblFpp41C5kt4m6eUbRBQDaRP486M7A9HvjLbMupk82CAMAciaZrMZMhh6id1\nRid6cHSWJhSpOfNfpJbg/+1nD0djqGssWFEuWmQU5UkE3Jv/hgXKu0s4Z8FG\nxNzSyIrJHgxdM0qz37fEmVwHnE0HeRVfgOeynpWsqDvgpeshQh3YLuEdIbdc\nzRZyGV3uNlRpAUGM9yPItSskIPiLl7osiYeS5E1vpEAZx/RwkZg4YRXzDT0P\nm2HDQOAGHoeO40gUpFo0ZIlF62JRHA4F5GqWAGsnOrSDwMmG0ouQVSfvufng\ninuU540ErK9RRY/rVwGrhv2oH9AxGGTKCF5xQaY0GKR5KqGQI+uqR5vw8JEu\nXBNlTbUdZw3LOud4WKPeSK9bkQC1+j4fQkmN4+LpkOQtkt++0zRV2nXvVSht\nX7G+\r\n=vfJ2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEXgL3KhQHnX3Dov4RaeViFXkf9qk42kpPo7tfuI4wI5AiEAtIUhpt2XmibH0cKaqxLD3vxKN1PKzlSKHR7GJlHSS0w="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.4-rc.8_1539804040609_0.5216551748720368"},"_hasShrinkwrap":false},"0.24.4-rc.9":{"name":"ipfs-repo-ci-test","version":"0.24.4-rc.9","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## TESTING 22fff\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"ad88baf6772d68fe609f21afa8ca5b321899b6ac","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.4-rc.9","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-9ZMWiTyhRbeeNcyPCTc5X/Exawn+9YgJrXBI7oFta55hmMIQGYD4TWGnRIRJ5C/685OY2dgu7o1YqZDgPheI7g==","shasum":"bba0d24915446149595428c1c8037789c002f9a8","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.4-rc.9.tgz","fileCount":22,"unpackedSize":2290529,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx40JCRA9TVsSAnZWagAATKUP/0oK+YIicIzwDNOu4hGs\nogkMU+RxvzyTBkTk6y1u0J6B1wPrqJc6OHJzpiCOltwUuQTfbez/efE+pc1l\nNC5iUCnkL99xgNsyVhUToLSlkFy8Oa+eLHP/Syc5W+WORo9277mAKC6ehUaC\nluHunPv3Rkpk4R1e3071R8M+1k/vufVMNBkF2o4PJqp9n4W5LLWGSnXjlckZ\nEMJCQ7vE3wUOQ309yl3v73gtu0jlX0ALA4EIQveE9PbxEUa+PpHXc6w2tZzD\nQgLzIuja4xSDLwZ4LpjT5Xv3IcE98JYF9aenWfwybK4Wd8mj0V0XhFHrw5OQ\ncLDhGzuqS1sAy4yo0ybA7cAp13NwYhNQCUd/sSnE2ViCbuft0vnK7jqFnyv6\nQyxwfSM11St7nTgU+6PEl9QHGtThFr4I5rOhT3ecK+Lr1V6vkN4JBL6eNmyZ\nXcVYPaXAaGucqfBOEoFqAxuj7Mf7OzkiTPKP97W2ixz/9/QkW7LSoDukFc9p\n/7brG+HVdxBnT78tBxwhbz42Dnr0Spn09l0cdux4b+aHx8QLvVsKd1oWEq37\nfG3aUnhqBdwHiBfIVu3JCp3MiaATHU3aPcKjnhrJlKrj4HNHESArk3kq6lBS\n5xgkPdOZoqlNf/nuj9Mr+AxW50gckI1vRXR3YixnkmNJ9vxHOr/s6z491/tD\nAEFJ\r\n=QHs7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBvRcbbPskIym1kUvb4br0Dx8I3QlPvOzV5ZLlEqGS4jAiBCxlpEEDwo7GHMZktpl2kG1zmP7T/1rBwDXJLONAhykA=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.4-rc.9_1539804424840_0.5382386780390815"},"_hasShrinkwrap":false},"0.24.4-rc.10":{"name":"ipfs-repo-ci-test","version":"0.24.4-rc.10","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"1864eeda7f08e836ffe2551b27a7594a8742eeb2","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.4-rc.10","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-ZF29dk4hCGe3gjxkkY1mh1TS0msyeTgOYNhs8uhLikc2cUWXkRsF02F1VWgVPyss8ZrNyeU2qejS2vRuomDucg==","shasum":"6be2da252b974195b4ddf3697dc67ddd707ce301","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.4-rc.10.tgz","fileCount":22,"unpackedSize":2290512,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx47nCRA9TVsSAnZWagAAKk0QAInMC5ZeI06tS+1SSQHU\npNDPuqb6jFtQzLWQjkyA/bjqC0ItzwZ1IZ3j9UaOrHoOcowjJcL+bFwA+Ukv\nVeA1HkJkfcdAKJZMi5FX38v1AWi/ZTBc7ehvWkXm9dqKrDDVTzplhbv16CCY\nbQ2NekJ+ZLFoT0xj+NLKB0PJN31YOX9wLsekf05FaVDvErd2PhFrwF4MyFCY\nnuyiCQ80KkiLGgIcP1hLbagsPdX9HZlaA110gIoymjvEJgJWroZrQpHJ6Sfk\nYGl25NUC0RulsG+nXlzt4fwRnT4ZFIpMJ4xBtBsTRiOxr/tIjOEcuI82Y92j\ncxzNWUQ3EoHeeHDwNlKLJSdmCfLMxbUhFVdM/14XOwGdls7Y9ZmTpoGSnZJM\n5Xel7m04EAi15E+nhOCALqXOcd7wtr44AgEIiW99dn9VvoLfEVQr6cVR5Msx\nfUm8YYiEUdql2h7KBhRl1XP+B83fbYeNl/G3j5xA4Nt2d4oBsFv3z+2rKJTA\n2Xi23okqwBasX62MHxzdZgIhAnFra8M7bSwcmLNaOE/+VLC2nZj2u3v8ofnS\nHEM37/Kg8Tp7jZiDXLICooiqvTRx9bwiZwSxsw+LpreCik+3+hhfiuWkadtA\nKpN0pcaf6wQE7Oi4yi8tFv1jHfgHhYKNI6rCmutBL/J5Zr/IzEEQBX8uV0mW\nkmzQ\r\n=B5mu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB0lGNr5ohU1aWX9FNd35jQ3eRPlgT7MO/Eh1U7H73hLAiAl/mqpZfEd55Rvr4TBul9mRtZovccY+ILfXAKg86TBww=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.4-rc.10_1539804903007_0.6048053154865087"},"_hasShrinkwrap":false},"0.24.4-rc.11":{"name":"ipfs-repo-ci-test","version":"0.24.4-rc.11","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\ntest\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"4448e1abc74204840ebfa6897e7bbb01fca8104b","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.4-rc.11","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-XE1o3KO4i0sVLEGZOAZgdZbItaMrt4xy49xnH+Fu/bLzoUUqf5WjsvqqxvVLCALuRHdATyQFBAeiRP42k0nahA==","shasum":"88f187c889af28c425d134a48bc0fe0af097d789","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.4-rc.11.tgz","fileCount":22,"unpackedSize":2290517,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyDdVCRA9TVsSAnZWagAA1FkP/1jzTueSB1S6+zNlCO2L\nnuri42+yEH/zmMXOmrK3Lq/iENDPkR3Fw1oiGig0kIdePdlsHvFMAvSFuW2Q\nmHIsCyH5/g9lVUy3e9D3xVjxg/mr0iRV6Z1q9zFDCPVxdWsFM+Pdq+p+HSFg\nHZmAOHB+U2fSDIncHEw8sJsLv5If1lHuL3zwtCNMelaK5t0AEk61VF8qX4Dq\nqPPGsmiHvT1S0i3YLHDpipkoDkfFj/oIteZkhNq5sQQSmSllmXsolHRTcJ67\nXEErLmUISgi9Mcm5xDiMOcmQ8uFB6Oyb+E1rmFQJUIFzaka1BdikzoE+X9dz\nXDpue/iHYp3SsiQzjbuBc15v/Pp0KhexbQAe5NeU/EI/mYuyCgnpzFs1g6dN\ncveK+HMaOtacgc74GunZRgc57MisW3YHMj3bszzC5Dlqrnz0Rxdiki1RbJO7\nLagFI6mn9nV/4+KBb7UGDXgBWB8E0ClSJyafEf7Ky5SuEniYvqCm9ERiP+wC\nSJCRLFfqV3EOjawnqNGYf7ubXAXz9cB15HREmmvn4NSgDGtec0WPFJe6w8qk\nsAvZa259r6k71FGNwxh5GCBQBRs//sE30+svrevf7zJOF27QFQ05ijgLPxVQ\noJNjXWQL5aSaJFwNrjQ8iDicOVRJYr5g9o5UuJ7+P8xqjkVhcvQAI4K4qtD1\np9Ca\r\n=uAFB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFtRnffu2Pg6goxfgLOmktSc4yLuqm2zyU8u7uahnp3LAiBzOOUYgyMFA/8FbIWeKAuZc9Pq09gDhE2D3wc2bKm01g=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.4-rc.11_1539848021070_0.022971380084481297"},"_hasShrinkwrap":false},"0.24.4-rc.12":{"name":"ipfs-repo-ci-test","version":"0.24.4-rc.12","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\ntest\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"7ea1cba58053c1161cc7c460dbcb6dcc111f1359","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.4-rc.12","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-t5dMYM+1iNBCRqArDpqhWG01FXq4ZXCnXm2ZhGt3oQgpiAuvRzrJCATogqaQktixASdcuWSnDU0cQibImYLIHQ==","shasum":"daa57db764e0853ce0f1decbe30a67272465bed9","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.4-rc.12.tgz","fileCount":22,"unpackedSize":2290517,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyDjpCRA9TVsSAnZWagAABSMP/3Dm4b4riix43CYs9PZW\nLQjizRRqZKtU4hdqg64CSkhwrOnAToHYp2HBVYDZG6XERNqWNq0BXvK9MgbU\nn9zSsjdLHFNpoR/4O3m42MjRmZ4gU94ogTp06eOiFG3kl70dM7ChjOzMdq/h\nIDnaaoR8Tnds89dIFP+RumVGJUA6EOLl7dEQuMyZntAVIFcX6JRsmBgTc6qK\nlvzWLvJfq0A1Jg0DyBeiKAf2o7NlRHhYZfBugVRit2mN1M/LfFqcJISnQ6lz\n/5zkIsouNuODw4IMG9bCmQhehGAdHt32V6NwRSG8CqVl9zs6x8GtkJReoK2Y\nUEMq45BIhAAyUdlMhbhHLZZBjigY7ObL3/bXU2ZB7xZ86vFCghZjcil25KLC\nUsqfxfMzavo+vxh1F+q8D2SmOUI+6DMjK1YEmIdlLXLNrkwhr4XtIdLOLXVk\nZXbLSrNPzARkJytXSQH4SHmbl4H/9HWBnu1kjV241vQJ2XI/BuHul6185azM\nsWOpTeVYPhce30Nq4mFxAFDcNabNfxGGJwjx1eKOIN7Ak4BaI55LxUM7maZw\nqwk/W/9x0M8YuGbIhS07eVavJRMsR0prBabvRsWMky3Uwal+ygowwO7547fM\nLmGNiJoKP9L9XarKe+J9uGpaLRN+KmV3O9qZdf40j+uU4BZKOZmxEMRAi8uu\nluXw\r\n=t/pn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRKlGtUle3axADhjkfPfkJoJcrakhliCh2RgCuF6np+AIgFGguwcaZtVqLQs49Z/hwjbB1kbyEn5OqqDQPlMLX+iw="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.4-rc.12_1539848424425_0.5797443448608246"},"_hasShrinkwrap":false},"0.24.4-rc.13":{"name":"ipfs-repo-ci-test","version":"0.24.4-rc.13","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\ntest\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"711e3a41b3a021d1b9fe5218bd39451b4b2ca2c2","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.24.4-rc.13","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-Z/RDgeTUyNzTMyQ3UAUvwezSCGQjl+QyrUXyStmSFf0TJ+g0Ke5CjdrD9U45ut43d1CBnFOsMd0EgA0hjqxYFA==","shasum":"bee2d559187f8c231775507d30a09439d83e597b","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.24.4-rc.13.tgz","fileCount":22,"unpackedSize":2290517,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyD36CRA9TVsSAnZWagAAXuUP/R130CLN04KBsTrU0W9B\nrFMqnRhsPOouOCov4Mp75sdfYG1OqTS8AvLAhG5QJDyYSgASzBbrnJyOTIst\nuy6Yah6ljc10k8+G8UJCmKpncDF0lBtH+naw8x1BaSvDlKRMANJaoceF9Wn4\ndGVdMid1dToQIVwjZulcrvn0pKjn+4CuV8bc1QDUy10R1BYAPrTKjRXX40Rj\nhGjwqXB3SlL9xleVLKZqGElhDJXJiYLz9b72s8OqGORnY69ARXPMIH0k9zDo\nbgs6GDZNWaDqSwGjTJ5oGOFihVqk6NPjF8R3Ip76p03GFo4Y5ORQ0AHI4WKW\nXNH7Mbvjstm/+n8VRz7hGXNWkg/1zokMRlwk6p9LnG2Msb0AcJjvF2f8MrMs\niWzBGTTBzoI/ja6M4poPI4RZYpnK0ME4GVyUZylCF0+onc/+++IYmdgaSYFy\nOL6fXABhEpR7xXQyCR/lVvO56XegncJS3XmvbS2xVoHzgI2ncOc8hSXLlPD+\nuJ52Z5bqWNWnJklGuy/F/CLEysb92Oq1o+RGfOZ/9fdUl+KwVOqlcLJM5XQv\n8UYZnrKkssGKMkieAeuWYaKgdCvn7EQt6yn/1CLdrcnwd6Q0kq9aQui86ams\n3eAa9hvHSzbXXU1SvZRRHuMWIaX5Z4t4DqS/ICFiTBk2ybl6k1NbNexHPsLI\n73p9\r\n=0A03\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDH+7ybzO+A+FCv+aUKI/vUWk7yW9TqvYBNWJTTN7zR8QIhAKFzP3tYVl0Zuqcuk66gSIrdukatw4bNXq/BBfLl7Is+"}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.24.4-rc.13_1539849721301_0.4163777849733117"},"_hasShrinkwrap":false},"0.26.3-rc.0":{"name":"ipfs-repo-ci-test","version":"0.26.3-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\ndsadasss\nnpx release-it --increment='conventional:angular' --beforeChangelogCommand='npx conventional-changelog -p angular -i CHANGELOG.md -s -u -r 0' --src.commitMessage='chore: Release v%s' --src.tagName='v%s' --no-npm.publish -d -n\n\nnpx release-it --increment='conventional:angular' --src.commitMessage='chore: Pre Release v%s' --no-src.tag --preRelease=rc --no-npm.publish\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"9b27579bcb2ec96e061a39a101bfada69ce216c3","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.3-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-/9tkWehLv2+Z/fNHT/C/70f4Uu3bugHkwm07wDkIDN7b8Abh0rcOLfxlPRhZ4ehVISIW8yoVTj03QhdqHLNGLQ==","shasum":"097cf95c85734cca4d60bf375a444aef3c613669","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.3-rc.0.tgz","fileCount":22,"unpackedSize":2295644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyKNUCRA9TVsSAnZWagAALWoP/0lleW3eNRF07PgxyYFz\nA4IKa1jw2HcvejsilvVtweKyuXH+y/ciKJll5BKSbSKprsWMudRNEq95gPZg\nq8PF7ii1XMUajBzuz2qw3xHBpkGlInFNuHDpzpMdTYvbcLgB9GFVNpxog81f\nAjMtnLDO5XCwSjE/tjQ7vcGv7mlVIXX+SJA/Be2An/xPct+P6+oYpTQH30yC\ngQ+UW34Kf9+T/y/aUcMMa9lt6MK6Y6gO90jeBCMYRLZ0mZ8ZXzLbmsRxr6Wz\nEwhbaXZvSevkODLfD0CZggN1dM0AW8FHmGR4aZjG78x0aEhRvQVKguUdsfFu\nVQKdwVUVWqOrgKFz/urEnlxnXSp6l0Kkr8K6na7LJFw92yIlABo+5qpO9WSd\n214R30sjm0krn++9BjbxzB0te4CNgB4QC9EhPsyrtfSBSMQYfXPMo+IrpcAU\nrvQ5p+1MjC1qMAq0KbbpwIXkuAJGhAs1u2mND1FZdvTCFEb+8HshBazCLV6B\n3RKjL9IKr4J3PckJ8TtioW9bV8ZUdCPVPkXjapfxlfwWKKWYe6qxE1EQ0rE+\n2/ZdeYyV/4tj+R8+4neX1lbQUOkJDWcm7pux4MgxnfcFS+z0RDCWWxA/Kytj\no1rBgtNfRxbVWSqFM1kzqZcuD1m3hTfyT3XW2Mz2bcS2khvi3jehsmgpDR81\nvErU\r\n=u4Ij\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDQp2RLFRJv0IRzThJXB5qExat/qRrqrRDsH7yIyMQYNAiEAnC1y2W1tkx91niRfe1IQyi9X2uZgmFAHyy4FrK2JMRQ="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.3-rc.0_1539875667771_0.06126852519430037"},"_hasShrinkwrap":false},"0.26.3-rc.1":{"name":"ipfs-repo-ci-test","version":"0.26.3-rc.1","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\ndsadasss\nnpx release-it --increment='conventional:angular' --beforeChangelogCommand='npx conventional-changelog -p angular -i CHANGELOG.md -s -u -r 0' --src.commitMessage='chore: Release v%s' --src.tagName='v%s' --no-npm.publish -d -n\n\nnpx release-it --increment='conventional:angular' --src.commitMessage='chore: Pre Release v%s' --no-src.tag --preRelease=rc --no-npm.publish\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"c5d889585832007392b79212b2d8df426e8fff86","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.3-rc.1","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-3j5TShfRlsPhhwwrZQUE1TIu7hyq5fPn8ZZUzynB2O30DSH+f0XX/EqLi7/zjewnJN5lZegT7QwpZWQpou+84g==","shasum":"f7dd52dd71a52036f77e6ed508eae12fb58a3bd4","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.3-rc.1.tgz","fileCount":22,"unpackedSize":2295644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyKhlCRA9TVsSAnZWagAAFDAP/jFnvwwTl9BvgVSLWqLD\nd5aGixmqWkqeugqEXE9rH7jwPLewEPTkG0raqeCTe2xGunx8sSNTzGb638JG\nCEk3nhtssBinA9dHdfRtUvLW83+VY2T4r9n+kSLdMr17HUXXwBdz+GPnJA4s\nBYkas/SYc8q2uJZBmifoB6CXnMF/0igqKjcSUsv1OWYuQxe+392SJXvj5lgd\nrXcOp/VZ/2FDhYj8yVm1sy2tRfNmHkw6udNHIPtDrYnSN+9rAX29s60IqrZD\nip2BUDQQbyCWVQHlmWnbBCfKZT2UUNoeDwU7L8u1wT717pTZ4DyH7PvL81ig\nRxtLxLpzhAyY7MaJHB5b8on+85NLuEU87sknroOIJWuRBmvWlkwHamb+7Utr\nlP2XD2IO9ID3Wlt9l0EJSHU1QxA2Myw1Iln2cUn9jVLpt1q2ucJoafWSl5kk\nlF31VvwU1ShBkTK4kz3J4Xohug6DU6LL757nvO0DepN5U89f9kq5VX0LDtS+\n+XefGVa15U/jwQtHXX/QpAMWxafoSAlxjBKXCwtf96QRXOgMp9feK1VkEF8l\n0gBXEpMW1N0uGZNFIO4lIj659vj2XdoR/rZHqOa5mDFzfkmSOZCV/gxITsHn\nJx3zoLx7WuVCTwlgUlVdmXDnkFWOL7eYTSkUampB4O/53SdzBwWQps++WpID\ngf9X\r\n=ubBf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFeC357WZebbpEt2wmajbObab33qD9Gec2KfrwP+sqE6AiBM4ueO8kQSQiNYPjAG2/1q6hNtQdlEsbI4Ao1OgO1w/A=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.3-rc.1_1539876964805_0.4074395137919362"},"_hasShrinkwrap":false},"0.26.3-rc.2":{"name":"ipfs-repo-ci-test","version":"0.26.3-rc.2","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\ndsadasss\nnpx release-it --increment='conventional:angular' --beforeChangelogCommand='npx conventional-changelog -p angular -i CHANGELOG.md -s -u -r 0' --src.commitMessage='chore: Release v%s' --src.tagName='v%s' --no-npm.publish -d -n\n\nnpx release-it --increment='conventional:angular' --src.commitMessage='chore: Pre Release v%s' --no-src.tag --preRelease=rc --no-npm.publish\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"d3f90f1869dbb9e84847bc9ee95b49894609706c","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.3-rc.2","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-ZjX1447bwgmv+zLn1lgzNlAFZX0jvp6LiwdCGjWeWJJjLTdT0hOrCkLiESLeUil8F8+mjpePJ9eSMSjkRpmQig==","shasum":"f1008e2e613fee5559590d1de09fd444368a49ad","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.3-rc.2.tgz","fileCount":22,"unpackedSize":2295644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyLRHCRA9TVsSAnZWagAAVmMQAI0dFJcohEXSHrZeRsC8\nq/1hVBXXvnpv1cOvt0NGNDEq9mDatcZjOjp00yOWXRLWAvVDK5S8dtkvVUzt\n26b9sYaJX0/TWOAOTwSQnoNQnnEM6xF6zWCQX4P2D/vfFTNeybWXsM7ZzGMP\nOsVK1ipZByahQPq9wkfQ6fuWYLgbnbral0OPR4WuD11JkQ0yJI/QgzstkFRR\n11kJo8y2hzNlH10EVxv7tqVVHS5kChWxTFvEBkwq3BidqXkafRgnSDxI/9Ni\nGuwa1oJovhn7pAdUljmyVDn7sd7EOACQsnDjtt1wkuoZOmRlrf2QwFZRlhH9\nAACz1sZTDebeh4y620RGOPsJtCxk7fKhmJ6KDkxgW4DtCHZwUmMEpi0C1Nex\nXp6LMGleyuff9OIr/yxbrfZKiPt7rqaEHk767ceiuNxFQoOa09VTkv6DuH/E\nw+Qvf7MHR7ffA+B1y/qADc5vDSr6dvYlwsjrlSlN+XfsPvdDePX/yF5uzTlh\nMmTQ3n1EbToNjzxOMaPU8+leaGM/oixWprMhSIV1ZtVSZwJd/FrEpPwXC5yO\nwsEpXtPazewmanAo57FMpkIErz7WWz1/QM6TLR+Z0h+7LFsQxZ8FOorv+fWf\nxogKJfrlwXYpjZ54B4YN+yTEoeIMHoNMSIA5SSzhlPv64LQKOaLnlQ9WvwsC\nc2em\r\n=nQwm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAKlmQiYTZgnR6VJ01RAqYppXpKD/7nn56K/bkTMu2gEAiEA6E0E5c75Xr+/RA8aOC7N+UpzGWq2L7NB/ZTIi18+enU="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.3-rc.2_1539880006899_0.11947753476367451"},"_hasShrinkwrap":false},"0.26.3":{"name":"ipfs-repo-ci-test","version":"0.26.3","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"48e99deeb1b2193df99bab41e39ad71193147693","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.3","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-mUbhDYftijmp4uHL1iaeHR36lshhdbb5hHOZNi7tS6CAQqwN9W7FBEHAnkJtOritGo5L0t3v8HQpoVnJKkwQHw==","shasum":"0ffca1af196e4d373a6bd66beb6f9a1de6470cb1","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.3.tgz","fileCount":18,"unpackedSize":60187,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyLVxCRA9TVsSAnZWagAAWrYP/jQXrQWjY5V68FJcM3uD\nBfXiLK5nCb5e1xl5ed4MnreQ1j68fB55pRooWnQ5LqbvWtlLaGxT4ahFnBJi\n0T/9go0c+DHbfQ0q7sbWnDLEKnP9krzDSr3oydhZbXmuP0qEEwyye0KrnoC/\nNrjqdX3sHFD4Pb4y/U3qc9PsdKxhc96R6oFDvSqAf1RbFFwYUd3iR2c0Fiie\njM3xv5g05P7gqxrio4nQ7zlAmiXidyh30y7fogwXGNfsoiRZgI+Ci/6RoHur\nzOAIc9CdLaL5sg9sGv/MsGMzpXTRZxuhuP0A5NbolAZBt91Y4LD8EZchyQCt\nBIJy06uxeMZ2cNzqX3EqBaed49YFlmisux8ClmR6RqIqz83UacLmKPYaegXj\nwxHnubSe52dOw8FSgX/fhyQPQ3AWfa5mS/WiJMTqqVUPKqCFrCfX7x7R6tm8\nqlMDSmOUQIlcxV7sjz861v6GryWUd0qeL5RClGQB6GIBGnZ6oW/Z9xGk4l0O\n+VmCkwkBZ2M74PjrvMYFig27ISA9NZSwhf3RUgQ8Uo0ox2jUBng6YMoxFnIN\nbp0hgA/dS5u3uBDThaRtvVYLN8ij8uPWpmQd6IhgYNgtAUUU7RMsoXqo9sus\nE5EiHDZ4mkgmUh+Ln1PUOgZM4ZEAQu1itfgr8VSUwWTfz+O7JiwMgXmZUaYa\nPoB9\r\n=ffb6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6gk+Cr9jcl44xZGy53vqD5yB9Zg8OboUik/nv10uFkwIhAIpoQL5kdw37U6kuSLeF5FHIZFN5e6xo9j+KixTMg5+h"}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.3_1539880305151_0.3814049587421331"},"_hasShrinkwrap":false},"0.26.4-rc.0":{"name":"ipfs-repo-ci-test","version":"0.26.4-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\ndsadasss\nnpx release-it --increment='conventional:angular' --beforeChangelogCommand='npx conventional-changelog -p angular -i CHANGELOG.md -s -u -r 0' --src.commitMessage='chore: Release v%s' --src.tagName='v%s' --no-npm.publish -d -n\n\nnpx release-it --increment='conventional:angular' --src.commitMessage='chore: Pre Release v%s' --no-src.tag --preRelease=rc --no-npm.publish\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"e2280f16dec1149f8b38844ed942229c4f9001d2","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.4-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-Vii+KHUFg+lxGSgi7X4KbSAJrJWZvMhgE0gWaa5IoCSLpF8x4K4b+Lwc7p7LF9TyKEHz09loudwPuU4zFuQs2A==","shasum":"da841dd308adc6ef200d90b90d9f7d3101bb99a4","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.4-rc.0.tgz","fileCount":22,"unpackedSize":2296712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyLp3CRA9TVsSAnZWagAAIlEP/0D0xxsRZHQGfgnlXxmj\ngXXl2XdB/D49vGVxwD4nB16xJ/zB+foixrFUCmeLXWpIbpVVfXKaIDBedakS\nueatQuCaPMoKj6WI4mu9N3Y9Ai66SD7iB5AEbLWTJmZ/R7yYXeCRtgOpnB+c\ne5bVCwi/47w9tRGO5R/XhdQJqXRkxMdqCeshENnFK5ERz3mc/RJbXxGC4Td8\njZadLnFwa5NsXdCulqMjF9743gwpWDJMKt/DXclYpyacCLWxQ4RCRL1xaLb1\nueVk8FoptbqAxfevWT98xaFKZN/0xaPYMi/cSGojYIvELLKrn+nAVH5Tmx0s\nekBB9NC+Z49qY4xoFL+N0QsWMZU40z1lLSj7n9P2d3QXD15RXU+0D5XsJTeQ\nicQsluY2pQoaVovx1ARNMe2Neyn9+LDNiazxTyyBT26aDSI28rELk/ja/AZk\n1UoKYIwH+yWCNFqkPu/e4YKC40jZr5SLLye5/eEeZ+FgmiUr9Einzi+Vziug\nwtl/Yn0UnFpKc2WYoKIaBMNDWz5MU6Dij+IDbGIUmBfP04eoEoXxFRkqvKgN\n6AUu2BxNWhmzNorFcvySGlPrl2rnoYaQxWhFpyfcDch0D52cxHgmUd/AvqkY\nDE/9Pwtucif/owIhoi0OJtXMkZyK/8nRWLY+m1eBj8/rOdSoWyMf2MgfURIk\nUgL4\r\n=a1E/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEPoJQ9OleIvhCXXADLVO8ZVAa8NPglAIixK2GiWqj+yAiEAnGfnyQq8UDzGCMUYcxZWnx81vwBz2xt6hifUoqhRbHw="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.4-rc.0_1539881590760_0.5434290846680312"},"_hasShrinkwrap":false},"0.26.4-rc.1":{"name":"ipfs-repo-ci-test","version":"0.26.4-rc.1","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\ndsadasss\nnpx release-it --increment='conventional:angular' --beforeChangelogCommand='npx conventional-changelog -p angular -i CHANGELOG.md -s -u -r 0' --src.commitMessage='chore: Release v%s' --src.tagName='v%s' --no-npm.publish -d -n\n\nnpx release-it --increment='conventional:angular' --src.commitMessage='chore: Pre Release v%s' --no-src.tag --preRelease=rc --no-npm.publish\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"6d7cf400d52b256a7d698868743c4ec4ff202865","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.4-rc.1","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-14q/AxPArn+KjqHyQRBdg6jCtMGyUSIduP1edZR8hRyrWlY+PUACNXI+LxniFt3Aox6piBnkTuKgk7Jqo0F1Sw==","shasum":"f71f54674abfbe70c57f5b8576cd56a82fe2dd50","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.4-rc.1.tgz","fileCount":22,"unpackedSize":2296712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyLwgCRA9TVsSAnZWagAAsEQP/2KtKbbCei9NKlF3fw4A\nFhkI72TDP/ehS+nWfuTPn1r7WHOR7WHX+PcmQ+LwMDboPLVmolVTWBDGF87W\nt2pPOZvYz6bS/sRq/3cwaBRj6J4tmQ3YhiohO5wMJ5rKFw/Se8VG3uPOhce7\nmmnj8NL8nnOjhcvahEfr9PR0Nl9yljPle3OStR9ejJAghAvXA6bbf3Z2ikyr\njOAeL38SDVtB+CRTaxg60b2ErH/U2Yu4tarYii7uvbKiKhN8MpknVE0hjUzW\nQIo0wFmPaJiBOn8U3Vu2Z/22zydnz3OuUyH1NMUyVW+YOycf98M+Pycs4Z5G\nvPoT5tFqaXVupXFOmJGPSIwPtBUJxQiB5d2RJR3yw7Br1W96lxMHP7DlvdCL\nXZAqqJ6h2ktP2xtza+Xi3+mkIOj/AK/WQ4PgnVwnx8F7rY1hOC2PeFwpI15H\nUeR1UgpE744GIi0M/05UkigNKUGdJLQKwbuXa2w0XCTrFzQxwPs3hWAtpH8O\ntcYhbAYHXC8jVUSRbkDSOZm3eTpZ7fDAkHjjN6nK4WoL4n/KztpfGe5qPCCc\ndoEzLFmrHqIgadNr5RmYbgY6byyMN9jzkyfq+T9vDk8e8w+YVRkPkOEn8YoD\nEDhsqHc8eVjI1bnc6QPRpPaGOLHxi1Q7cl9zES2zMSiY9uY2uf+kcc4ujwgL\ncJP0\r\n=Ed50\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDnzBSCLBGgFUmxddayKZUPnq54ifgKDmd4MIpI60QjYwIhAMC8huDkX7jVI+NEfQEd/HnI5qJmtQaAZtUOMv+Un9MP"}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.4-rc.1_1539882015988_0.831017242770113"},"_hasShrinkwrap":false},"0.26.4-rc.2":{"name":"ipfs-repo-ci-test","version":"0.26.4-rc.2","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\ndsadasss\nnpx release-it --increment='conventional:angular' --beforeChangelogCommand='npx conventional-changelog -p angular -i CHANGELOG.md -s -u -r 0' --src.commitMessage='chore: Release v%s' --src.tagName='v%s' --no-npm.publish -d -n\n\nnpx release-it --increment='conventional:angular' --src.commitMessage='chore: Pre Release v%s' --no-src.tag --preRelease=rc --no-npm.publish\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"e90886344446da9ad7db8eb00137a1dd5aa53a83","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.4-rc.2","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-8LZyQUgHo7eAU1lTZQGb5UNrgjvnyP46q/GEAullMaO2zQWIPZMEqmRVR8eJADHQmXjHszv90IPXyS31s1HQrg==","shasum":"6c8361b57fb62d5d530b7e8cff1fbc523d1fdf0c","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.4-rc.2.tgz","fileCount":22,"unpackedSize":2296712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyL2kCRA9TVsSAnZWagAAYqsP/3r69r6b8f05ZZ7uDZYW\naHTqTP+d6XEjrbZMNbL7cosix4682wkft4SpqEa505FX5GNnycVI1KGYIjXe\nvYQwEkS+yPtYn0x6L2Sb203QN/KinSmampCWp4PprDez7fRu3kNQvhsPUYPD\n0xrYOUNosBgcAijlzaODbmYlFkLePEb1s0nfY5627xzQEJyeerFNMXA5CjNA\nOpqsIgCTr8L11HOE19oJHBzdQWJdh3X4woKPB/3mQ0tljPtW8+l2XOi8P+Z7\n7P3MlSgetau4IbSSlTuCHiySqcBDPNCKwnWrEjRJ3APBjtd8jvROr6f0/fNF\nXbb4JJ4eSMGza4QbYSeBECxyaxgfIG3OgZRx3wlIh9S6pzQiSw4yb9WkzBQy\nsRYRStdWMqkdzrCDlN9TvQ33UAwgWxu91vza+eunnTkJMpXU6lAejLCTswTy\nUnBtb+Xqw13AU3bkQobqT/0emg4MF9E0IVlsxcAhpSlddTtlfVntD0pSVXi/\nnixJnus86sg62NxgWRh7Scr+jyKw+mj2fW+ksN0Glgutj0/oUPOtOwWKoQNh\n7r5/cRNeAY5aCEHSTxLw/vbgyOVIep4GT5aXdtb4G6jMbeopyKpXxfVw9y8r\nFUGaX/PZVD0ZHmbvjRIVFHVHb9dMf5Vj4JN/FuMAknWgn6gKGL59FwRy5/e4\nZowG\r\n=pUC9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF7LU59R0akmqvzvHSU1/4HKM5eaArc7lYzKtgAZ/5LjAiEAyG4raH2+/elO2ZJlP7F92NpNOeKrTm+UkV8yoGiL3H4="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.4-rc.2_1539882403238_0.7247628172677409"},"_hasShrinkwrap":false},"0.26.4":{"name":"ipfs-repo-ci-test","version":"0.26.4","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"637ffc65b665747c5981fadd048adce585a721f5","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.4","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-gp6AQ4nbnRYNI5JcumF4CEGcwr0OkGLWk2ykbVsvCKL399e52a9pkNNOb0tVQE3sj0TfpZtNSfumOtQ/hIPsOA==","shasum":"7dcf79e4d669819a29e2c86a0b430f1d93b58e8c","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.4.tgz","fileCount":18,"unpackedSize":60992,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyL/uCRA9TVsSAnZWagAA/awP/17pTjDMuRiuaZ7HXp1R\npmosirPPuBJaN/AU7FAeMx1m+qpNzJezfIR/0H98Sl4a/8ZrAEbDtfL+dkPy\nLITvsHCdj5d7ANSGzIaoB6rSgVYZaVDQGQPyK/YRU16+UJHzmEPggcBbLRPD\notoWrr61pKBPSJLKdhBYiVEMRXKWdCNHGtjIsQmIbozwaj74i+8HvEzbqdmf\nlY/kFYx9bLOQCrWQ0uKHQ4nyAU0EMDh5KhKUdTMefWB65oqqZmAYPskC9qL/\nUFJ6oPwotq/tDa4waOSA2JPaNmatGO3ixZM4hhaW8BcrZioSzVb3hJNutzxf\nNjAnAkQXI/oju/yTdGOWQXZhJ4nuWJC+0UjFvnafJ0anINBv/CR2jJj4Kpz6\nciPDaQagPq6oPC4sF0N9vq/lxbMqimEXmbMs3qS1S+jl5FSVwlxfWgS7Cb0T\nmKGAbksepGo1ftDZizN+8nXDDHezD06Y0pPx7b1cdtG5iWvySEczKhR/2O4k\nE1GuKjclUaJ6yue0oDsKBezePNMGwKuMDc4/S/y22+knPreuim24WuTOCZpq\nFd8DVw+usDmVtcIGefzuZzQsxAlwSXWuq74r+hNaL69xIuijcXg1dwIl2gEG\nhbiT9hUucnawa3KPPPq0Hbbg9/Mznp+CVAtecGpC9y/Mf+4t5o0+Pjz1BCbq\nlL6c\r\n=uNye\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBaDe4/AJ0oXR+szR4Df7Qv3li+0ZO1tv7hEkXG6SuDgAiBNgRVJqVgXS+15N4GXZxz9wa4iLmZolu0bJXFkFLfInA=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.4_1539882989445_0.9355061880393623"},"_hasShrinkwrap":false},"0.26.5-rc.0":{"name":"ipfs-repo-ci-test","version":"0.26.5-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"dceae064b5fd62969c593afd36b73ed3e2a38e8f","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.5-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-FNI5giRSuPhUJ29ItqHV8xGsXjVSa/vVEhNItxJXi678uIvMIUDyTetS6jRRq2WZtvv+zaSjDwvI+jx2MlFqMg==","shasum":"fdb5d92dcea7fee724d0d58056a526c54c5b2c6b","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.5-rc.0.tgz","fileCount":22,"unpackedSize":2297348,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyMIGCRA9TVsSAnZWagAAES4QAIV787cr3hTwLf/GoMVM\nzH0cR1vMkyoGlBeSLwJNC1si+uMYDEeM1bJG0yYaMDPAigreSM0itGcc8B0/\nhKh1HFMIICe+LutDjiEyxk312ShF5oKxy0NwSW2Fgy1lDL0nA8+C+75M18SF\nnipOc8XQMyhnBTChKXhHkMGK+/9rZu4nGgMVGI4rivO8d92VKtue0FeG8/V6\njT/JxaaXPW+QwyGFAYlN7AZaLyt10oAa5pQaHa0Ozy4OyAdkplvVhKv7CKbO\nO3B4/pj1P6ECBEAnrLLy2ZOuaaOSQf1xzznkSYG7e6TvJicbzKzX+/kIlCz0\n76RcbXe1Ql+dwF36NL+k7g1+3dG7+lV9EMk3FEOCS9TiiLd7s4cakONHG/RL\nnk4xnQHcACoEdG7eaIGns4HUmbp7nT1AowseyGLZXWm8dZK3LXitcT+45Al1\nw1xiSAE+MNrhkeXmbwv0pl6RLKAy4MSQLsiNrFE4UtM8PMVjOBxM0bwSEfoA\n8FNa5oie9+z9dhm4+d1mykIKA+BXirgBNCDRCJCZEPzNJQXDlYlaGYUZvxk5\nMYWVHBu1FNOcnNf1o1udhjtshD+8h/w4VUpmQGauGRWTQaGmgh4Kp0dCIw14\nO0x9qKa59UaMVgOJsdBfV5vjSMb352QM0+y/NFsiNgl+d+cPsh1qzjJlXKuT\naDHZ\r\n=zNpI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnRrHKnNnn1OzOVOWp35fSnnWX76JBh3frPOyzZUD4EgIgcYmF6lEtn42WSBxvzy5OWnudwobk24nTZtLRfSIQsRE="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.5-rc.0_1539883525577_0.6883645093546555"},"_hasShrinkwrap":false},"0.26.5":{"name":"ipfs-repo-ci-test","version":"0.26.5","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"6c7324e9654cb649df5d0a666f24c634a9ec1d0f","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.5","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-2cT1iuSzxeAILxF5W8XhBCJIBX+/fL9qOH15yQmn67ecuNoS2jtUcL3iy542L1HOsy32vnMRBBhrTtQGUtGVvw==","shasum":"b337192eb6a393b56ae0d1e55884b87ec4ce3bb6","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.5.tgz","fileCount":18,"unpackedSize":60815,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyMLqCRA9TVsSAnZWagAArfcP/03lJSgJmWJJKcco8mZF\n+vdynnvSstPWjeqgMiDzvrlr3N2r/7oTUFvSAsI5lMEemCKdLvuwahFMrSXj\nPOnlwPorUWUbXGOyW95QHGppcPnxmSYqCz7KPRUzcH75nW7tyIZu9wdRuDcG\nnzodKTxEOn1Mrh6DAeuTGG/IZRzArZ6hzvYxqu6Dme+UBcvyh7yT7HiCWi6e\niQc6aFVuz2XAzQFcQIq2Hlm90IzJriIN64HWhJcQUe9d58oQ9FhzImUiS6/x\nwIFK1Tkh9cqhQ36HA7Q+ZotAA1OK7eEG7jQj3dpNnHko4ddUXrmJa/2fkKQu\nOrBT+73GPrJW2X8ntdfWEsAN122Jrh/BpTXqmjMbEtpRXywBAkDn3I5Zv3H+\n0uER9tTWmF9GnZvEpgBRM21ZIaWoh24sieV7koPJwoyPvUqLv67czVszTgWB\n7hiA4VOdtlXNyx+2dlSPyBLyT/u741CFszw5WuzpJEh8rxVsjHIhGHY0kR3R\nT52TEKD1ab2G352ivGtYFsdKKyzuxnu5S4FPVs8ArVd8xvCDEgPuN7BMaXn7\nRt8RDUBlsS54HbbQ5AScR9+Z5BghUleOiEgAhTJb7FUeeeA1Ep5qoh9/1zu2\nxOiPlBw/qfXXQuHpL05xuQFG9mBFLhV9VbJF1g0N7tgg3F0Sap4W2z/oE+iJ\nK8Y7\r\n=NyGn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF1JBRtMdtbAnKBDsr1h+kTvVThn8GkKtuycBSEKxKOEAiAYymP3jRMZcr9XstAFnxxIbWiN0LoiTF8hkeCtPGcchA=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.5_1539883753214_0.3277497778929279"},"_hasShrinkwrap":false},"0.26.6-rc.0":{"name":"ipfs-repo-ci-test","version":"0.26.6-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"3db19961f13c50b66007d6a8b9baa8148eaa68da","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.6-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-Y+KSaypu9PMnUlvRyiOm/nqBlcQfZ4WIby/A+g0UNoUaPeJTvoKEwoB9DVjgBQDTnd6L1mEeNhDF/Y6g3lebvA==","shasum":"fd553326dbb9b2eabb480a64c868a5f966b6e07f","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.6-rc.0.tgz","fileCount":22,"unpackedSize":2297589,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyMUJCRA9TVsSAnZWagAAsCkP+gJ/wdKYO6iqpSsoQpAa\nqvB494LXgZhCiLmfY98Xby+ntjBw/MKCEFdGvAkq/zNoZrTZK5PEZua9lX5X\n2zTis4sIiLiTRBB8dLaUoEq3J24ji3fAOL6uB56iMv4B30GqkbWIJBD/WTxh\nFDWsxpLiVJjKsn/uWdwf3We37X/uHX6Cv0fBztOwcUleZnzhzBplcmof4bzd\nvIyqwTywAzJ5167xes68bi9VpzSADe9UNeGWotLYFa2LSJZctJ2YKMJh1q1t\ndpJYUDmjkVgktqbQ3wO58svRm9wltj4BrZw0bg3yLiMzpstuN1eHv9Wo6ORk\nBOiMgtI6AnozJFbe53sZGG8oIjZe/sHnvkx73ivHauQB5/X12dY+NQdZ294X\nB305+IyXzX68VufNJOARy7toiBy3P34g9HSlHpjj7A7IBTXQFEeNdYYxfCMi\n7hJ3TkvPcDtP8Jr32CEtrMEimgRdlG44g9oq2d3HWYVwRMaxU+qup56Lu0Uf\n3jJLWWtnfFVsEHLXHcKGeG+3KXsjM3fw1edgCrld8TuWfZj5aQt1oMTZXvgW\ndKEMXEf1leKzxwjzRB97wmftQ0NMEs9yIVTDNgEoepvdEIPljjf6KaUoz40l\nvRyEvmW2p2XOoi3TcfAgu1ar4ytZcu6ZeghLWHnwQY7bubgYdY7ySK5gUo1+\nHP/L\r\n=1xwt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFkM8gUUw6OomFHYf8aAAeC4PhQD/54V/pXslMfDd0Q+AiEA7GzoC1kbi+PhcoumUGfjYd9rlLQ0qcV9tGYBylut6aI="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.6-rc.0_1539884296965_0.41989057701462107"},"_hasShrinkwrap":false},"0.26.6":{"name":"ipfs-repo-ci-test","version":"0.26.6","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"b41d2d9d4669730b73e11a793b93110e7ddfae15","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.6","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-LwGqOa1NukIPXKvoIo7haP4ko9T4aUWCD6YshRqyT9GQ+DUQ6s0AAB7RSUSIqiLntWJ6zF1CXVqR2euhkSnA8g==","shasum":"cefd73225aef3bf04778d8e5fa7ff7e08531bf97","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.6.tgz","fileCount":18,"unpackedSize":61056,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyMWYCRA9TVsSAnZWagAAJ/0P/0kgJcZgImFt0brZmZHP\nX5U0tJV7/yQDfwl+Y/XbtLtxOecXZKENzLIP17QCaWMALngRcsNxnnfNDxWZ\nwJ7YrZY3DMOmvbwm6N9N1bbH973uo7mnprdqgaK9W4j/Vb3OWHQs837EuP+x\n/ZsmbeCnSxY+XNe0uteAjUZh2pdbS0L/wi3KaDicuoH4ouNFDfUzAoi4IBnC\n7je3tXeYg36dAQ0J14FJ9Zhp5zxC0p3sI/LHUM7JdGjWDFg/8EDfwBinlM63\nLPYTjRr4SNABZas9g4zZq5q7Gh6YGzFKfGsePaRjuHNdANSd7uFquWoNirlk\nuCAc8HT+TQslbxoBfP7Unkb3Q/atBYEEDijD0JftiL2DWI/4PaXj+BeJnhdl\npUBwJ2ez+4DX7TyEwt8PESnjmo3xh0WP73rCf4vP4i9Xtah0NaOyQI40kyeZ\nyofKdFqNLmzJYBAagsFqmIpBc+c7EMDtcAua34hdV4ILsX64OzjPSvjke4x+\nsIDKuA/UXez6AzEU6rIrAK2wQ7kF89vB1exnnGlFFgAV9+ZY/+eQtEfPehs9\nf1VURf9sZWU0eKaF6c4hwl1j5dGEayV9DnQKtgzKWy6uYgNAMNUesnpTAbKn\nTwQ4IorQWWxrdnFUh/MSOi+Ab8bh18FIczAm6Nzt/cooQaz9lO4HidKAO+R2\n5fFE\r\n=/bGA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7PojY9JVosKWqpaCrBFoq/N8UXVgr4hwHxQYhfmqHDwIhAMqpoyJR4rOahwlVrqXQjaX/Qyc/zorvknoDCsCZa1eR"}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.6_1539884439835_0.14856460570741414"},"_hasShrinkwrap":false},"0.26.7-rc.0":{"name":"ipfs-repo-ci-test","version":"0.26.7-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"779426c5753b6a5962c0bb2e2f6a30b34b4bb32e","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.7-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-gnf0fQZbCGZwpghl1EuGSugc8QzL/rqFBrOZvMX67a8G5MDlms+7J1q1DIBbooZFIrTh9fz60ISv60mZneJKng==","shasum":"cc72ef06a713be740d452deb8c4b200b5e81434e","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.7-rc.0.tgz","fileCount":22,"unpackedSize":2297990,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyMvUCRA9TVsSAnZWagAAxNIQAJDcbH2XJ72HDFMU5X7O\n8MLbQnt7YEFEke0cdJyq+l7UZWte2TLxajAWqvf3oP1jZ7RNwFzAkJVldbeW\nUla6llAX0ocEr1UMv3dKeymOIUJfz+90LOhrh35dLEaBuz29hbkfJOQMyIVW\nX5ieygumCZY768VKPIx3gJIIpOlZmaxdIWJiCbTHBT+L88WUxVIz/b3+T1H5\nksKVP1e6KRZbJwMFiPztvrYN8pkikKvD4zH3UHEjIgJlNKoNgOYAriHhXNrY\nh1bVciVLXx4i65V7rcLPtMzt78Lz+11gVh70yEyfbuyi17HFqj+5Lz6Nr/JV\nVe0zQWDfJbWAaCLez2hwVQ7dHuSvBmXVG6ABh5mfVyBDfwyh5NkHi9xMSEuZ\nD1PBu164JBZ9Fy8uWtzSOO+JCGPXhPlJ+evb9qg8XlmVMacDRrnVUL17K86m\nJKr6rQ4WBKvvZisouK/jJjeiJCG1BLXGKnqwRU1BSO7yLQeDnlsqczATQCte\nyJ6fG9+uhNmwejDBZBoLaeU7xXFmzRRXnYtA6yPVzhrcKgHTyFqBhG+X7t9a\nIR5wNeisfN1nm6zCPhBMFApga9RtejAfRngu3r1sSJeUIKAJ/JyRekuUj3VL\nU2DsRo5fDWEWq+BQxKC9kMKwlUOGaUnnmirjOXwCNPj11oy2MU1NCnbTqe2O\nYi1A\r\n=BG/x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDh3OnHGx9PO7RA9DTX0XKAxQYTKDkBZ9uHZJb6nOFRyQIgG+0gFVYEN2HlYS0ieiYEj0iYA1hHZS0f4ultjLh2r58="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.7-rc.0_1539886035497_0.47999082214270894"},"_hasShrinkwrap":false},"0.26.7":{"name":"ipfs-repo-ci-test","version":"0.26.7","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"3bd043e423a08410c5f1f7c4613a1172273f0e47","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.7","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-Ve5DUQGbD2QLFO7vydd3Yh7AWoAzWMtTfwQnpMWGAI027bnRYHeWNgNED9G2dP2VKDtNCr1lRkP0+opvNtRV3A==","shasum":"f677fe9414d2e98dbf479e4f14310138df6287f0","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.7.tgz","fileCount":22,"unpackedSize":2297978,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyMzQCRA9TVsSAnZWagAA4xAP+gO7/5plYEOnGXai9zee\nsDQYPivQ7fgldfJhcjcOoxCNgwQkq9q9l3H8GvJXZKcjQ6VSOtqF9HMYCSgv\nKsIMy81mCYBkzmjgY1yT8x3nYXn3tuBKTZgWPrv37IOn0EfC3zHA0YAbfWaL\nzsdamRjWrjqlNLtWKOY5/oNLxP3m7NEDY0FV5lHJ83c422fxuepuFXYE5ntv\njXKrddi1kib9ctDK+8xGjyhsHSChF6Fu6Mus70YDn60gOKftgRsiwJmv5aou\ntmBBw4S/uCvSE/MWebh3hGbmwOQCkTLaVh5zJPP27FRtlQsy7tvm64f3xm48\nhl9ju8qKnkqrNqLKqtq2yhA/MzZVbNE6YPgnzTp25d/LbwlFPvYzjR4nlqIU\nddLH6bzJED3V2+Mug+b3nPcNG1/E05ufv8il11JEthaE20GPOSw8HIkKbLZH\nFBgCLc+AFHjfN1INfPtsdZbeXdQE09E7vfqkl1P3ZqJaWKQ1i7FDN41PjNVB\nUfnhQwST5OD0+s1pBkIqrPddZJ5+XW2h0uhICNXJE/MBSA3Ub3O7jQ8He6sh\nl7osWXjrV+32kysXt0FfrkdIHS2YXgsPKjLrA0Vom0EjY4bmLjLfz1NXTlIB\ne368sV3J5+9oaY29Kf1DnjezDAQ9RVC7SKULAICnBXXZqVsItUcYb4wQa0KV\nBQFA\r\n=y5MJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXEzsU84MlchDpSpuGdWdsfaOWjvYxqI6UPnT+a8bh7AIhAM1FCBoPbhamg63EzJH3aSffomrCmlE0OM0f6PzbzsTJ"}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.7_1539886287017_0.23701125509665588"},"_hasShrinkwrap":false},"0.26.8-rc.0":{"name":"ipfs-repo-ci-test","version":"0.26.8-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/ipfs/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"c6bb78f195ca52466f12bc2a9b5c37b59b8eb38c","bugs":{"url":"https://github.com/ipfs/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.8-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-qwLm7uTaEBn1oK4IexOqN2f+fTt9TaVoqcOnzCRLWARKMH2y6tCYCpDnP/zFGCKTd4E+/f72qrIz5+vqffjKrA==","shasum":"b407b236e8f9f3ac77d3c68761cfd230af373d81","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.8-rc.0.tgz","fileCount":22,"unpackedSize":2301691,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyNCHCRA9TVsSAnZWagAAwowP/1ntutksHO6LnOsgRU/m\nrElRkHbMZMK6PagAYwEG5ptsTqhsDK6KMt+RASSWQGsi+nrijhLjbGzFJfDV\nM00ieHh6LXHZj1XPrPcLVtQ9ma8ol2oTDDgoRqF8dwTJxu9Fuu46HNKD5iWd\n7/lnLQXfjkGWj3FYvf4E6fYF9CvkhTYg8whl9e8jhaInbVGSU+hW31srlwlC\n4HEEstUNVCrVzrV0kmcGmJPk4NnVsTpNskgdMByRKeFeu5bKCYKYBq0TP7uR\nIVVZgYxsP4TqnkIKLGOYz3tP0I0sfZ5pKupU5hmJMDwgoswNED89SVOEglWf\neYkss1NmznLlxdX6qn4xwZ7YX0YGQJIcUdIjiYWidiKkH+FNVHy+n7hrlr3R\nm+BnPX13fcw9mNnH/yiqouEnI+L5/TL5/5D9OsSAHpCTn8/Kr7RKDjaF2x2n\nE9ib7f27AGpbLRUokm3dM9v3ZR5B7EpirKifE0TPRB8pzaUql7KhypTOBIcM\no1ZW6sSwsOrTkgYH2wMvVMGdXbK8LsHPRVMZ1T41WFBcyY7EvLFyccs4fw+s\nMN55H5GOLzpfv2XNV16pM2bYGqzLzqBXZE0YRMtw9ZyTs/pzrsBo1DbLi155\nTtc7g3yx09NlvZ4sc4m1Qmtmgek7T9GD2kI1pLY7QWgnkxqiDeOVrEc4vnFI\nEBSV\r\n=2tQ0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCH/cq7cbNWlfihbnKgYYxcG7SEglCm28yW3OpPwvwfegIgJUa3FkBeJx5E1hMKgG3iAaNPw4NRoC0QITpQv74XOoc="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.8-rc.0_1539887238939_0.5856015874361309"},"_hasShrinkwrap":false},"0.26.13-rc.0":{"name":"ipfs-repo-ci-test","version":"0.26.13-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"0106a80f72c83fdfe58780cba9c65cbe5c2e6aea","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.13-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-X0eX3Clo6nEeIXv740DXv0hq0yx3i0hLAASlHcdebam+tjtX+FVRlTAmBHzr+P8AMHfpkb+Qv54IxedlXZWidw==","shasum":"1cb2b02b322650d808751d8f987a539b274b7dee","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.13-rc.0.tgz","fileCount":22,"unpackedSize":2305033,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbybtwCRA9TVsSAnZWagAAMjAP/R7eNoe1Ma710L/j8HR3\neMRMkEuZynl/nPZNFuRDXgBoGeL8bZJ2yscTtJzuV/6oKZmhTscxfdrcVDbz\no17C6HchNJqLp/BQb4lfl1zQ1VqPRqxzecI6b6l0ne79ZCY1os8uDHLyKQSg\nlb25I7bLlgOJPvtIH4MZASbBsYP304us8bFzLQgch0mEyh8oVPtb3gRRynjK\nhGbalM9YXEh3J8q+NrWSXd4W+sQ7QsnWWIlhGk63ziHAqcTbgx/vUuMlkGH+\nhEEjnuT9kKH2kBZn7r75xYqUkOnBb/wiJXEiy+FJbHshPvmSjtbpJSIhzE02\nX2jggB5kz2CGvMVHuiG1l8R4R4wWoEPTxuwvsuKxjO2RkVpLq809qdBgEjvf\ngAPjyotSSBzjAtk2BDRJBIypXoo9XdTG/ZXOGLTDXnpcl5PN5MRqikB+d9b2\nUaCiwjVWncn8sdU/jd4NAGaX44WkqUvEGLGCxEKnsUODWP7sV4oZU7EHtHiF\nTui4HTP7z229QOeo3r0G/60IAMUt3bVEzhW4qIZGNOfPWj5Wr3kNYiT8zrQi\ngF07Ka+W0c8ErIPBOIpnR4OyIaRS4eGmNopKyzvxphBEkPr1Ve8AwlQRc29I\n5DorGIGYcwlPobAwoKZPC5SrjSLOsfSclBeB4XD3AAJl254EKEIt0rwHBs8K\nkAPy\r\n=m3gB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFjrMN24ZMvXymxFy0+i8BUMF+39tQlTuMW+vDHpkXnaAiBA48J4Xh/b+sBdakovquFnm+FTlkigCnR+0In0JCfMEA=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.13-rc.0_1539947375745_0.024464114729178865"},"_hasShrinkwrap":false},"0.26.13-rc.1":{"name":"ipfs-repo-ci-test","version":"0.26.13-rc.1","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"c7ea6497c6882a7a046b623ab682c80562a638bf","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.13-rc.1","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-IXYp4BA51JnpliH0/aRSsEsinwK+C+ZJaEBoN2JLj4oHYeIv3gKYbNeutrOBs2ABb4KG75/s43edxJwe5w9rsA==","shasum":"56ac866d1f5a67e49eb3bf691d0a26e5dc3477b0","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.13-rc.1.tgz","fileCount":22,"unpackedSize":2305874,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyb2zCRA9TVsSAnZWagAAD1AQAJgtT9TfVbkOSCJdnJlZ\nWdsDH+By1NmOk+k9o3BJXFiPjl/lcRqWjUFErnycv4/pIaQxSQernZnX78yo\nSBkbbZZhzOcoixOmcluERLRfbnImuNpyaONpGOGMDD4sSBUMzlAd/m3F8nLD\nHpc5T3NyUJd3IWocU/fAt0R+xMA808pFLQ0Y2inh5OJGwJZGrqQ4E+CNaESP\nkBAT2xoBMTARYf/SigK6aajgHh5Wmw60d4+uhd3BNbQvlAzdaG2jB0NzXuQt\nU2rtf7lKVvfYLoI3bPvo464WFWZBk9p7HbLiGmubPFqBsFqefJgETnSkpUnb\nXvYWlbIAeRfGYpUj1ELmWRQOAuTAG+yvdVgslO2fORk3RkdwCYoKkcRGyGuI\njnylYskHtg8u+rUV3BTpiT5HY/8Sojl+agN/AGnjPyDNJG4KoeTZnBPVXuhk\nIbpPudCtjNMQMRHkHa1g1/bjtF1Gc1S7yjyo9iN4D/d3FlfFUmyA/IX6y51R\nCzG8NCbU0amdba/r6qnEEPCPsj3XTSihP2/ZYBm5YfcKRpR2ER/BQrfooZ9I\nqiJKN8tgKf0n/nZ4KLCkMDDLSXg3Q3n3wbjgWZNoWg7I9WHAE5A4gV9/4Umt\n/c9BAeXZH7D7Jea2ZwO6KLShPiug/Pn+4Jpd1p+PCvjCc9haYAaLhuwFGw8g\nz6Y2\r\n=6NBI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDunNwt2woGlCFGclzamV58ThloPNe2G5BE8WGFld7vFAIhAMwpqui6FQyEIDGq8assNkCNueEpiePbKCMhdn6W1I6V"}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.13-rc.1_1539947954458_0.13067833676920215"},"_hasShrinkwrap":false},"0.26.13-rc.2":{"name":"ipfs-repo-ci-test","version":"0.26.13-rc.2","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"71e3a3ac41b43f99b558aa8ffb360106a90b2e2a","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.13-rc.2","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-xg4qzMm5V2gqP6xEsETPkUZ1Bxnk1vkREPm3Xk66MTyaYvVoMRtBWYSN6g470tzvzQODV1P4beWhjlB5Euze4A==","shasum":"6547c5ee9bfa2be73bae75b9a056f9e1f45a393b","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.13-rc.2.tgz","fileCount":22,"unpackedSize":2306834,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyb/3CRA9TVsSAnZWagAAFSIP/R5mtPHLvK7GMhSk9VUz\ntMx2Jz9dGIDFo878xy4tusxhe1rTkCjxvnm33kyNpV1SwGI6kxaFAhCkpU3F\nPNDat4V6szf2i4anEibYz2hPU2CiInyTTbNQdVghDczBsSAON15tyjj7RSlC\nH0LSDRJcJiKlHID7/LOqXwbmHA9BQv81IFuKmABDRFF7aK0BnTQey/VgO0CC\npBWw7NZBSAQrUbUeZjQUtCYsiDKaXn5A9e1ZDxr21zfDFfPdG+2HBjfRW3nY\n/s0hrbP2Aj6FF7toCQplZoUSByVrckH2U3F5zkep0VKFar6KJYXaMxPjQh47\nI+m4plI7VcrTmO2qMgYLGZ56ezbTOwoepwdEDyBbdHCxZtVkJcAie6GdejRE\nBKZ6aLDSN0W7OtZ+sqG/sDh+DSSRmZj28jjAZt2sZodcO1R+zp1b7EvEee+s\nBr3q3iRSVLIAEQV2h5YjmccYIZeuDUO8Sbf7w3T2cotaR3hQPhlF/ycA5wLc\nhmWuV6uZK82TCfFTdc73G9ELRS/DpbGnd/mOkQMqzve15S6qUwP/43F7Tey+\nATkLn4oMJAANB9iZFogk5MJtK7Qz9Orh8VKZGZ2b+wLWytL8RLK3vWJk2stC\n4SDJgs3BlYOE8/MgW8Mv2YCrWJ9hMIXiR6AlqC4kkDYJ+Y4VRXXTTCpnJUFF\nNH0V\r\n=xfwT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyCaJ3ZA+LE74MJZC/zgiEYreM0DhanZv+JKbVKh6U6QIgH0B1ADzLTUAfEdmwuINQbrwSFaBGJlrBVdsnbeB13ec="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.13-rc.2_1539948534695_0.4909471376775658"},"_hasShrinkwrap":false},"0.26.13":{"name":"ipfs-repo-ci-test","version":"0.26.13","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"63e707a2b04cf15ad6e8437f5397ff2b33f0895e","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.26.13","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-FH0GSKQuVQJs2W4ib26tDu43OjFRd1LSCV0skAZSVBeaZzPGges6pEEabdIHGZUa0hKx2UHFEEap/rY/iK4AGw==","shasum":"f6c80e8f0237a70e4bb88e687f680cb3b35305da","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.26.13.tgz","fileCount":22,"unpackedSize":2307741,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbycGhCRA9TVsSAnZWagAALgoP/jXPntmzipT9UrdlNj83\n6ro4NrV5Ud8udmrtlGtm54ZrOfDJ0ggnMYCTjaO3j+UM7u48JSThtW2rjgNk\nGdzIdVwRUfLdO/0gs4wkUQb2/8Po8lpXgCw2Rwf93wHuZsvHSL6+J8zMeo0X\nJdoMrWAcg0appLiAY1/kuxIjnrUbTVdZKkHFkPQPl3barh81de7P3fdDtrnh\nqVhcrQypySKMvVAkf2Ot0llAwpm+Nt6eg9OejAq0NKYnISQfeG3DBbFb9mAY\nPxSHiIvk7MoOVMk5ATXCW1CoJKQ/t+71UH9SteBSQg+W1UdUVtBu4jZW6VMz\nl3jHAQaYB1dFUS7E7hF0p+Z+kKeaEUIoQJM2WF9xIzw/opxZuHDoXThIf6IA\nybeDupCpsIuHs422ax9E57sWL/IzmjNg9/fcrG5fLRLDzdeiZDjWVbvu9RKr\nRdBRHl9bpH+VTy5nyzopVM2n07JmJfY3K0UtMm2gO90++zdtQ59BaksJNn3y\n1Ls6XxCXaPXZKeF34rINKgKxPQYn+pb1zmCnA3Q8fqh8eJTG5A5BNsC6MvIt\nZmWeIomMwaEybvvaw7PG3xBHOV7d/rx6QDdjEyRFIJuqNUo/V5OPdYanekTo\neJtNahYpPZm4NGZJuWfm+a6x0lgQxOE+9s2AG1GcY/UYcQfVwG5bzzCaI4+2\ndeX9\r\n=VC3u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHqax4NymbwBOaODj/CJkvSKJcZ+fOXlDzTZ8I/2CgmCAiAbhR785+YDMQnyLXTUX5oMS5Kb3JSsQvDthS/EkPNebQ=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.26.13_1539948960467_0.4669216578366542"},"_hasShrinkwrap":false},"0.27.0-rc.0":{"name":"ipfs-repo-ci-test","version":"0.27.0-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"71ead2163d2ae2b7ab2f782ca3eec72fa5ffeb53","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.27.0-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-ipkMoslX2piQz1Rjshnu3sTjLEnPKZJ53bl1A8qsVLow/MX1pRdLMnMbOBFcCsaXXj21KeJ4jRqjqVAusfn5PQ==","shasum":"eae1d53c416501c64ae21324e1e61a24cd796075","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.27.0-rc.0.tgz","fileCount":22,"unpackedSize":2308200,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbycMZCRA9TVsSAnZWagAAJR0P/RX5Dd/7kCSPedZeJ//d\nJUne9q5W+tittdyFQFHTp3Df2SzT5jQTEeH20941TKbrvLEpkB4TYaO3CmYA\nKAES7pQKGbmmwMyvypNlrTyH67zACZGj0wqja+L5l/Skkm6AzWdqSeXQx/PG\n1DJuJepRzl0RTcE35H/je/bdvN5ra1Qi8JD+X0/Rydp38urNipAdcZx6ddQ2\n/pfQzqUFtg8XtB71Ihxbw5AKDhfr2U/eu8a/VlSzN5Lmz9Hkss2dJ6swiuqI\nAgkVue6x+qbU3tCAnRyy5dKJtrSQ8sUTu5LbgShvOq7fsbrhF7SPVMuVZ6o3\nsGTjOR3J3odZ7CzinD0h1wfDHJF3S5fHJMbk/9D3xwI+nVSTVK9Wi66y60dQ\ndYiBQehEQfc/tg5vbeC9dDfyU6MWfbHdIi+TRlxAMviZNv70sNnazZc+vUFZ\nM8k0mmHF84f6Y4iq0vMhI8ez+kuAhqVTw6sJ/H037ELUzC/sl44J0ffrhBsF\nMilPFHVYVPP1sE/xEB/XVyxqrtmiOFfPxoKkEF0VYlGLa4MDOW7Y/musxukw\n1VYxjntOqh+fQYUBjNGScyVGFOr/y6Op5QKKY7jIRBsezsvuFAU803Q2VHJJ\na940gpNBajLXdZW9+75uxyrV83KwUfMmRAh/ObcVDFBPSkgLRsgJK1V09J4t\nC8cz\r\n=EEA/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG1V4CabntOqoOUBPq1NuFfev/yuTYNGiZgYFNnuC2JrAiAGBjFV5Vj4fl6YToxuvxd6d6o9IQX15faumEKmvSF6Bw=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.27.0-rc.0_1539949336338_0.49699192516522994"},"_hasShrinkwrap":false},"0.27.0-rc.1":{"name":"ipfs-repo-ci-test","version":"0.27.0-rc.1","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"15267a068cd954193b71c794119aa505781694b9","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.27.0-rc.1","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-scuXfRQZMiblLzytHJMmAHqMY2etJL12IkaFrjWBNGrGtpfTuW39zqGEfV5m5z53mBIeHGDxP1RTGwXR9v2GjQ==","shasum":"75d8580fdc88073fbba67c10df411d1c135ac9b7","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.27.0-rc.1.tgz","fileCount":22,"unpackedSize":2308674,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbycMxCRA9TVsSAnZWagAAiZgP/jkaGOFXSQtADTsqiUUu\nLXxoCFGCd7VZ8WGglfCUHjV9n5yphjSligw6d/TMRtX6JnDzaPlArAIyY+R6\neb8PmLIG1RyL5OnC+newuYJnt/mLvSWyXgnScTC1/9AnndGELO28cLuN4xnL\nFQ0Tbr9wJKEqXfZUP7dGqWgAwbBJH/Z9CanQGNf2fFsaPS1PCdpTPT14eB0H\nYT6fA5de5/yzBi1Z/jFghPabR6jGdukiViuGDR+DLRpEFCcTDEO8/662L1X+\nO82LvjM7MvC7MJ+zOJYXNa9pa8MO8/Z4iUM0F884MfsDtCrCK92rUA22cn7J\n3ydNNQt5102lAW5sk5HQoqzqFzpT3rDQNtG2HlKs1Qaf4vcfrMAgXVixxJaJ\ngnZZTxbKtY+OWRXRG56gpCkZb4+KZ9G4tBBeJtNuUZCsKEHEIM2eb7aGbAE3\n2RJOa5iQLqvfKTnPnU9jxdYXcf5vBkqm4AXpcpHqU51WCPwNWodDwv2bgQ9m\n5BDqGjMZk/1+/SphaLcHCdG0mJzf4Dsi+ZEEEz5tTwp15YgXaCvVYAF06Tq/\nZzH11dDgdrdQrGqUmU71FPk1eNu0IFRFiJeCMGAcFsql6bZVQ08lfNoPKdJA\nWg+gWPZJZwK5irKUv/fE+T5iCNOBMI4+KtlWURoj9w9flhQy6WDf4VcRPiSM\n7yRB\r\n=goFG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHClfpolNm1sw+FSks0qpv9V8ZS1I6jr63nfH2YfACZbAiAhJnGSV3I/FF/jy6sFnrMmqw3DwR5EovC/bYN3f9GSOg=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.27.0-rc.1_1539949360335_0.8380905573294637"},"_hasShrinkwrap":false},"0.27.0-rc.2":{"name":"ipfs-repo-ci-test","version":"0.27.0-rc.2","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"84af12eab449674e529f471dac2a14690960a197","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.27.0-rc.2","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-AeD1XZiYHFem7jw8KRUU1A/ExWGkJFURhuscuyNPyR1kV6Le+oYesJ//FG8K/EndBZGJLijcRX+v4qMmogMYGA==","shasum":"679483f0e6fc784ee972ebe6a6401f20f135517a","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.27.0-rc.2.tgz","fileCount":22,"unpackedSize":2309204,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbycUYCRA9TVsSAnZWagAA/IsP/R/9cjsuvBtrdFIW2qOt\ngkCjBr6G/k/GaCEXsNzOs7tkuYSpW+Nd5Ebmfu3vE2WjG0pd1/FzDqVyMU47\nJXNdL6/WDIifxF7c0F8WPmdvZl9brzQc+L0+oRX/CNZ7brMLA7l8d8eqNZQu\nhrVdP2cVzH4o0MHl4iE84uk+74PcROAUv0FXPNmxKn+QwSawqLEFT7TH8qgv\nQTnMkOqjxxkCcZD1ynOL6GK7fNK7lzuexLMqdKQY7R/BAteIg5tbiqv5Hpie\nWGEpDSOL5B5uOsMgWkcPNcXeSEBtuMrXxgI2+fTlkj/p0cKwd94PX8nHpnGL\nfPwV8rByNORGuIt0Q/gh7g7qf48yRw8TVPz6zAVFmpf19eHyl2YQzJjh5lR/\nsZrILDlrqMGb9OCBwRcUX3tf1Uw2AsNX5Uaes9rUWaUKvl1+fAEgWi2O3IQm\nsEzvYzH9CXzC8yqFvxJYQk63e3yTD1QN/U4Djdsg+gvJtLf/18v5/i3K1tbW\ni3O61gWVqOHs2EUVwpRxxNXq7BfGupy0aYCaQsfhhsj2qjHWRNxDVwEZzfbJ\nDgU6FM2kkPKDUJVtcv6lyAMq3DSlUcr39Ha6Ex8w9ZU1VF4l2JSdPQdMUFxD\nopRQtLYUKqVH86/4d+1lz9to+E0TZdHnNIWf256fdZsrQPKrAug37Ulpbb9R\nCu1X\r\n=3ObG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGiLMWdz8Unr+epmbURJQ1jQwaFkDSkRpDAga+YHbKBNAiEAh7zg+vM3ENB8XNnxj8rdpB9Y4zbeWQlhP2JLV5Hb/Cg="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.27.0-rc.2_1539949847678_0.3709116916206796"},"_hasShrinkwrap":false},"0.27.0":{"name":"ipfs-repo-ci-test","version":"0.27.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","release-it":"^7.6.2","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"49ce197dac7c48becc9d4b6b92e9e5ffc65d4d22","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.27.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-GkXTrYBK0jZSotzJWzGucN60enOEl51CKjEZFnkJrKYUK4sAfCYMn1It6U91QZYCUJ3iW7jM4QfTjJeATE+Tqw==","shasum":"7d69b2e134503969893bb6de40cf73e7bebf6e4a","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.27.0.tgz","fileCount":22,"unpackedSize":2309834,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbycXMCRA9TVsSAnZWagAAfqYP/25t0drkcPfbqTP0FByk\nTm1UrGVwcNWfbN6Kakn/WiVOxJh1aufIBueU4lzAe8dNVDny7TsBwtnl7xCj\nRjYRXqmKthwUc18rAA0tGLwMdczAqWmr1ZaGStts9lg1LIuueiebZMbCBCPE\nDQOQ80IJI8qRZY5ILMTVK6C3C9KEPSKtDdLNnjNgvcT5C/xVPJjzJ62SSWQ5\nF3f8lLdL/XYOpSRMOiZtKpDlhe2HzFlVSdDCkxS67aEM+5/PyaQ5uvIj0Ig9\npZ/v96ON0AvdaHjxknlfrWsf5iPDQJzyz1qw1Ds+hXc1t5NWYr7LTE/hbdy1\nMZrdkrE691r5GxcAuVrB8tO8Qdo0MRKXpAgWw+6nDDHdrH708H6bfVqL1nYS\neGn41EXhgX9ltj/5KoUW9C63WEEVBXx1yaVKBkTKYAy7Qg/h5bJIMYQeJG78\nPruaPLEjRk2gLr+h0tfWz37+zgeLFPMVDQXfurUrFjkxqRrrFy1VK36i9Z5/\nY1CzZvzIU0jXt3LNoguVojAOxLT7yIPpDMk+1n0wD2vwkP5zE14ihiJLtB8l\ni7DWOmEzXJ5DeYe3shwdvX0deP7DBz2TkrEzj06/C6W6lq7DwaW8mlX7l0Oy\nlsYGh/OgWh+wTsiLMNmJUiKfhuXdv4xsJOSGqGYtNp2NR74WFzeyx2cBTMmM\nicLv\r\n=OQX/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1zkspFeCIvedUbuM5IRMFeZVaXH7mvm6BvU0TYSQF5AIgd+HaKjNm2yGCC1yNQukahmqVajcuwiPJK9yEFKRJYfM="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.27.0_1539950027133_0.2234233593618853"},"_hasShrinkwrap":false},"0.36.0-rc.0":{"name":"ipfs-repo-ci-test","version":"0.36.0-rc.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\nddd\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"cf3ba0145fb8c21df3102f77a150fc122b093bd4","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.36.0-rc.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-18K76uT68HjB+lwFdsZqxK7JsuK2h/w1AsKfWHQ5fKMIsxmsRlLn47cCYJu/6Vj2srYHsaZpymJGcclrBE6FBA==","shasum":"e959a5b438f96c9427f5635c98cf000b8712b3bb","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.36.0-rc.0.tgz","fileCount":22,"unpackedSize":2145601,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbydekCRA9TVsSAnZWagAAFSkQAJT4X8zxP3DMRhMfNtXk\nJCWF+rYD/6wp+0+GYUniuwad+pWq6js0jzBILsjrFOEbqPYuL9Bg2+Ckcq8d\nAVl5K/s4j0cP7/IC2bJvc0BLccSJOTCGos4mvEymkrJnbOxi8oXvGbP0RvCS\nGP1NWwnqMUs7MxYsnsoUJfYenLKUdp8AILXwzwsnhC2wYQY5Y0EwaAehSs//\noZo0wekx55iXXa+XjCgRChyq7kg/shQ+UXNmlhzqF43zRUsnPDg65GirZLWd\ncqXgAS3N2W8OJYFGiIn+wD+C1cur1HQXo21w3IrJA/AdZ6V2L6mvxiHktWGx\nQ2qAnKT+g3aXeWFKlPtowC5q0qtnf/Ovx7pVmQFSJYLrW3+Ap8CYGSLmHxP9\nJo3/cVeuPFkK4qi/L6Poti4qWYeQb5INlWWid4TuNo5Ff9FNg+KZ3bLr4MtX\nq19PReFxKbTTvo6JEG9satA5Xd0eCz19lxpYRC9e+4UaXt2xnH8QVvYT8xg1\n39IOhVfGPBbE7rTfRAk01x+JPVBVzBmuDanW6MEgBPBe5z1RDiQuaHhAtMOm\nBVov4vBjTItVrEejbZo4tioCgujlE3gVl04UXLAZJWXV36anPpCFnIpFI5Pe\nIGpZlM1nYye11bXcfLtXwaF+hbSe1J2TIahWO/lprAxLov4uLltZO3Kg2pfB\nnSdQ\r\n=Q+6L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCitlcez0tvo06gnf/PcgEnBjrvm7ANhDIZR0j4J2+cVQIhAMEPq3H+daeL3tPSSnzYLR5oHYNyGd/rDMHBVtZCW626"}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.36.0-rc.0_1539954595901_0.885212846482561"},"_hasShrinkwrap":false},"0.36.0":{"name":"ipfs-repo-ci-test","version":"0.36.0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","rimraf":"^2.6.2","standard-version":"^4.4.0"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"05025fa104aaa185748c7d45e36bc10cb99a4ffb","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.36.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-nd7SY2NrjJU9iZZE/4VLHQYg10XawToIDgFhiDb/xCo5XaqGc2gy+6qYWzdi/iztr06xAr/XD/ehWInMm4GsZw==","shasum":"cc5f4f684909feab48690f71af1d7770613872c0","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.36.0.tgz","fileCount":22,"unpackedSize":2145815,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbydh+CRA9TVsSAnZWagAAX44QAJEGPoeE+GCYN78314HF\nxRaCiFGWSMVD1Whu4QON3Tyn0XYvCo5n01UwF1uYIEvTAcE7cU3vaM/gjASN\nUW2ySqc6kat/t3gK69++NIQ+nGMM3ZU5WbW58Mze+RtWN6ibqeXwy6nXiMLr\nYZsPM946mXK6BwqGVpuLyRD5ixw0llVmCzo/P43lWqy4+Bjujl8Wccjt3wX+\n+eFU2/+BDSxZC89EUp+N6IVap4QImKL6gfyLwr9w2BS3vwAOBmN8+9Fn8sNg\n5F9+5UX9taSTXUUvLtLy83kDMCYVnB6BzHmmdFjD0S2Cch39efC035Eiqm0y\nepn2HpSC+BmhE4LFQ4niaJzy2Exl96ddKZuTtnWn/GoC+tLLEWHLnjRS3/Vn\nE9iboo1QXnIuQq5pzu6V9YFi3OWZF1s7ncwr5dsClYfbGP/R93CXqjTTCPfc\nr0yqu0VlkVVb9Rh9H6a5Zj9HokBu8kz8eeU/a/4mK3GVSH1mUpyxwykdozB0\nDtDQAZPM1zt6bO+ey1+qJMLFHyylUlFvh+nvBgvezPzmMTtkK5/zaNAjBHpm\nk6zBwGfeK5C5CHTqU132K7j8f5s4Bb69ABg17bsXxVZrXyv1zuR9F1XCkohg\nkcWBP/jRIYDhk1hz9Dqeiu6JDFrtgEDHXvxC0NDoGkThAJJKVigpJE+O5pz+\nSYN/\r\n=EjCV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAJ/5PDJl8/FtQ9+ubtL5aVfzYsFw0e6Rs8IMQykaPcqAiEAnmlxSzsfLeQdRKL4aSkbYScjZ/FqcMCx5p/TOQ7+Om8="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.36.0_1539954813210_0.9040881995248482"},"_hasShrinkwrap":false},"0.46.6":{"name":"ipfs-repo-ci-test","version":"0.46.6","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-cli":"^2.0.5","conventional-recommended-bump":"^4.0.1","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\nddd\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"6a72103b59c46019ec5c3c0c1f87dc2ad38fe75b","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.46.6","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-sdpgObpP6jZaCNBiWZGVQIo9LexPh0Z1aPsd/MUeQCP1c2+iNlBUNKrP7TFCrpRRRWlLB/IlqPC0UlEAd37Q1Q==","shasum":"5be227da20f2af9977a4b6d70bb93cceec1c134e","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.46.6.tgz","fileCount":22,"unpackedSize":2312275,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbygZfCRA9TVsSAnZWagAAZ0kP/22nyLgkuNu3PtTzVYgv\nHWMFpxAff0blURfiphjvBdOu1FjOQK2EUgxNN0VYA7FKdvALEbssVo/wU0Ss\ngHacFvy3v1Q5vNr+mgDbJofCfRJYIHa/nzadzfeFbEuyH85lR380l9W84g6I\n3aZFtzvPbko7z7SWcfrJGluPuyqlxAybzqt5ybOuPhZyTgs/87heFWBghThZ\nhloT3W86q6t2n+Xxmc3FmiQcLRebOhFmofk+Wxou7t7A8WQSRY+3M6qw+kiR\nXSA4BuHitfdmhGfEUYGzM/e5j/c8PYdhRmiJAwTHlzPQ5OcUIirAwhewBFlb\n4vjYq/ZWpyX3YBvBGna6Ff2W1asEkVPssbebgvHEWjqctOGkvs5QM0nI5r16\nLmi4+C+qBaX4mfABviWPVsvEFdM/A6pQqbVGzL0on2t8dl9QNueQq+yrSA9Z\ns7bNYseEDnmU4Lf5KDet6xEYOTwuh4D8bsANdXYI1Tn8gpH8DTx7RJBGQvZx\nC27QiOiCQfRRruGun/9CWgCI4Bf1hLMNbYRjQoiAA9nA0a/9NK45hksi39hr\n0OXakuZqICTH9/x3RMXfnpZPGa5MmFK1Mklnkt6dAMJLOWM+mTlRB9V5Ug8x\nkDhpVKj921GBK3IGMvLWOzb/J4XOB/IJJcSpZge5kRMWU+czEVqzioAh7+gK\nsC2j\r\n=mXBQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEmNPCZNIBkIjjYrE37sYSYDLdC8mUomAvwsDU12MQigAiBzPLtrZWP/0ykKozdgyC14CToeqcSMMJOKK7pIeZbFlA=="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.46.6_1539966558762_0.9870579291252177"},"_hasShrinkwrap":false},"0.46.13-2":{"name":"ipfs-repo-ci-test","version":"0.46.13-2","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","conventional-recommended-bump":"^4.0.1","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\nddd\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"ed5ab2900257eed98b8ac8ec8666213e6d69634e","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.46.13-2","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-G6nYG+FXptO+FIdnwY6Gn55OYcT609cG5DcXG2efahkqIwJtKH9pyaEx4wfTmqnzDF+/zd4A4KXYv5GOKZ8FCQ==","shasum":"fb69c2dcb002a8d48137028db609668e10c4133a","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.46.13-2.tgz","fileCount":22,"unpackedSize":2172903,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyhUnCRA9TVsSAnZWagAAuEMP+wcjwBdez+71zbzIrWeO\nvOEiGeEsw9VMYoQ1ClROeIRYdI1ZXuijPemBGiHZz71cut5HSjv6cOJzvpo3\n7xuqnDujo+WGBga85rrDVbvgX5/px5O8eDxHbIWEqEiJWscGL80JGpIt9p7L\n7w332GcbwoN1ooit2y1db4Fp3nydDAQNGFQFDHYt6EtLEoHJs/blva903l+W\nbJ3Sae+3yX1GI98UMowD3nrUdK/ZSMs1Qh492TTvC7FBhYRnVv9XegC83qyg\n7nw9YBCAy02BMqP0lCBtPnQQH1ViPBvQYojurUP7aK1IOEEDw/CFpQONfHSe\nzhfsPw2Ges67Hu4+2TuwAGgLjREezpk//cs3XaxVsZEFfORLcxn79FUeXa6Q\nJzjE2iepjAOnjvSHti+ROGv5rWO3bHB3SmmzWKFdhwT7N4NlVeHrtnq5VPbY\nh1oixePiQmAoITLhC5JYsvurP8ijNs7LHD6N8IQRiMPCVtk8lCwq9aAt5zxU\naxykQF3T2FZBepKc1px1Pa13Gu1A6X3QTyasvlqmiEuL7bc1ff3CkULYfdVt\nwpksmx6le3O9dDG7eZ7AfdhnC3jIKXEGUg8kqEYmDmWDqteUWsT3KQQPAeK+\nmtKc26HTZFM44AKpBajOWVk/kxK58dr+CsBALT7+NVbGaFWe5oWJu8N+HPdr\nWP7u\r\n=UXOp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID9KMg12gThPm8VNZQwu+kq8tT3hle0ezHVugQ5HY/0NAiEA2GCsyjgWpwN2GKsP913svv8Z01lo4G+IKSD+fTb2hy4="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.46.13-2_1539970342813_0.39629929945488396"},"_hasShrinkwrap":false},"0.46.13":{"name":"ipfs-repo-ci-test","version":"0.46.13","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","conventional-recommended-bump":"^4.0.1","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"e182bb6944064d0d5e8bdbf586217edd05b9c6aa","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.46.13","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-TXsThHvgh1WaytlnGthA7VUrv2o3Bdf/YTNdVMYx9rkCyWqmRCPZ5hRfWXhYdZpYbFZiVLYajQ6M0poW0pHOlQ==","shasum":"181d802842ac725cdcef409eb8c0d2012dfaf327","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.46.13.tgz","fileCount":22,"unpackedSize":2173086,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyhkRCRA9TVsSAnZWagAAwCQQAJvTblA+Kr5E/3SbILkM\nGgFuoTwmpDPCWnPTzeXr8lx/uuS+lgVFyUo/fXY5PpNwQKP0SB2Kh/IQ8Bkw\nJUtzIsFkIeMIApYduKpAyjy2+rYagndza16o0wsogcjgi+ykJugu1btV3SI8\nODJmOuLQ75O3UYwfXNPcuFJPPhEiBN2r2UN6XikhmEjdGSA6zkyFWe/QExcv\n0LBiZLU48R3mcnmnHxQW0Su0F7+Zs1wy4Pc3gCTvAQXfaGLIx9WvN8lIhy4q\n++27a4lx0VZHBXnzrs1Lmg5++vWvFw8rMvp3K+vlrn4tnROfWpXJmfvwdNQl\nh7RrKxGax9OraiOSj44QZ+cPtiPqeLbTDSuzxP5FvD+rtupyQppBG0qvzekU\nfcQntsT88Pd9oLKtFhb/rgtwJwaY9a4qrRerd5D38sMq5brhqrDGdzS0iPzn\nfGq5PJxrmRlpnv4I6LxzSHlfer2FGPRKNBpcupkopmvXkEyzyicXI/R7mOzb\ne+fdsNdER473F/YL/E9yUVToXmeqi9aCYnwWOn2YRm0a3QUxNvzYsVl+S57p\n2pZR/U83TaYsIL9hP0C4u15G2ouxR40HS7xxP1DLFF1Vhje+1vb81BZlvMiD\nWaj4VH0EyFXw5ItTHJ2sDyNO5Ja+mTfJueWlf0OZNiFQhRXfmlZIGy7gej9W\nttbu\r\n=k+DM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFZ7obMcf+y57sQxaNCFwJ48MoLgrb8bObn7RL+O0O3UAiEA4L2j0kMzWp8WQH8jjknNqb8Lu/Ci0iD7Cd6fupKcj3c="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.46.13_1539971344236_0.1861732200765871"},"_hasShrinkwrap":false},"0.46.14-0":{"name":"ipfs-repo-ci-test","version":"0.46.14-0","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","conventional-recommended-bump":"^4.0.1","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/pipeline.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n[![coverage report](https://gitlab.com/hugomrdias/js-ipfs-repo/badges/master/coverage.svg)](https://gitlab.com/hugomrdias/js-ipfs-repo/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nddd\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\nddd\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"c3a2ef41233395cea8834d4d0b070c703ca78c0d","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.46.14-0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-h/VlEXEtW6ryUSzUUndyb2sqF5CGdwKgWImUSX1NWGq9dIIt1muAf6k4FA8R/HwJtwQx4LSOAvuwOFZNU19g3A==","shasum":"dbefbcf2fe5e57934772d085fda64fce626269cc","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.46.14-0.tgz","fileCount":22,"unpackedSize":2176181,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbzfyYCRA9TVsSAnZWagAAx+cP/RbOvFNsO8HLdklnC8VI\neGc16sYhfI2OYsY96eItHMMVofdv6Nhb1JpuJfaU++pclzqWLbe2x7mVblwP\njl0dNydYS4fHbTuhoM1xcCaTXDn30Z5euq0CvrQ7NmCGPWYE6hrC+J3OGmk5\n0Na/0lhPAoS8yKa4Vbbxd+OBylfG+iyGNi6zIVJ1WELoQ/HpdwpfIQKwJ8VL\n0ksxZWHPVzxmhYgPax/UnjY5UROMdV0DZ8nuBFnGOlRHH5xO/jtAGqZwgxte\nOvokXqTP459UNlNFCEqEphpxe25jdDoHoe/7EZxx8G7p/+l+khDYIohmZBbT\neAEyQ9uvs0IzFouWKCAFIhn+oaXEn0UlKIUIr3IvQaoZ/5yIu0X7S5R8f1el\nu7O8olBkn05RkZDwgJvd4vSbtyuw6Mzf0PpF0AXfkIumJYyPKTqcBh91hAtX\nuBHs+GPVMKS7JDqoZv9UJFEQtDOdenTo7ZIaXc0O9ZSRdJOsfTroCVrDK1ZG\noep/bOW/6wqaX0ZQ/GZereB/cp1R5iFNBZhHDBU2Fon6/4iNDzrMYcjsvQLe\nNF+LjZfnXHK9iyWR8T6L5zrlbW+nVuCr3Dmn5Xbnsbnw3XZd7Z4EJG8X5GI5\ng9XEHZ1S8wzuMXrdOlI+6sQGq86gTh0BCPv56ipoNaj4MbivbrQuZ5mkpo5R\n2oBR\r\n=4ASx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4NJD2bdjjnPAj99oNKLbwkRzUUtNROyhtHMGq78YZHwIgOK4eU/TH/wv9Hezjf79GML5a3twq19ZhZHUQcv3avUI="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.46.14-0_1540226199266_0.47389547302529067"},"_hasShrinkwrap":false},"0.46.14-1":{"name":"ipfs-repo-ci-test","version":"0.46.14-1","description":"IPFS Repo implementation","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","main":"src/index.js","renovate":{"extends":["config:base",":preserveSemverRanges"],"prHourlyLimit":0,"packageRules":[{"packagePatterns":[".*"],"enabled":false},{"packageNames":["multiaddr","multihashing-async"],"enabled":true}]},"browser":{"rimraf":false,"datastore-fs":"datastore-level","./src/lock.js":"./src/lock-memory.js","./src/default-options.js":"./src/default-options-browser.js"},"scripts":{"test":"aegir test","test:node":"aegir test --target node","test:browser":"aegir test --target browser","build":"aegir build","lint":"aegir lint","release":"aegir release --docs","release-minor":"aegir release --type minor --docs","release-major":"aegir release --type major --docs","coverage":"aegir coverage","coverage-publish":"aegir-coverage --provider coveralls","docs":"aegir docs"},"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"keywords":["IPFS","libp2p","datastore"],"homepage":"https://github.com/hugomrdias/js-ipfs-repo","engines":{"node":">=6.0.0","npm":">=3.0.0"},"devDependencies":{"aegir":"^15.2.0","chai":"^4.1.2","conventional-changelog-angular":"^5.0.1","conventional-changelog-cli":"^2.0.5","conventional-recommended-bump":"^4.0.1","dirty-chai":"^2.0.1","gh-release":"^3.4.0","istanbul-instrumenter-loader":"^3.0.1","karma-coverage-istanbul-reporter":"^2.0.4","lodash":"^4.17.5","memdown":"^1.4.1","multihashes":"~0.4.13","multihashing-async":"~0.4.8","ncp":"^2.0.0","rimraf":"^2.6.2"},"dependencies":{"async":"^2.6.0","base32.js":"~0.1.0","big.js":"^5.0.3","cids":"~0.5.3","datastore-core":"~0.5.0","datastore-fs":"~0.6.0","datastore-level":"~0.9.0","debug":"^3.1.0","dependency-check":"^3.2.1","interface-datastore":"~0.5.0","ipfs-block":"~0.7.1","lock-me":"^1.0.4","lodash.get":"^4.4.2","lodash.has":"^4.5.2","lodash.set":"^4.3.2","multiaddr":"^4.0.0","pull-stream":"^3.6.7","safe-buffer":"^5.1.2","sort-keys":"^2.0.0"},"license":"MIT","contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"readme":"# IPFS Repo JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![pipeline status](https://gitlab.com/ipfs-ci/ipfs-repo-renovate/badges/master/pipeline.svg)](https://gitlab.com/ipfs-ci/ipfs-repo-renovate/commits/master)\n[![coverage report](https://gitlab.com/ipfs-ci/ipfs-repo-renovate/badges/master/coverage.svg)](https://gitlab.com/ipfs-ci/ipfs-repo-renovate/commits/master)\n\n> Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript\n\nThis is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs/tree/master/repo) in JavaScript.\n\n## Lead Maintainer\n\n[Jacob Heun](https://github.com/jacobheun)\n\n## Table of Contents\n\n-   [Background](#background)\n-   [Install](#install)\n    -   [npm](#npm)\n    -   [Use in Node.js](#use-in-nodejs)\n    -   [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n    -   [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n-   [Usage](#usage)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Background\n\nHere is the architectural reasoning for this repo:\n\n```bash\n                          ┌────────────────────────────────────────┐\n                          │                IPFSRepo                │\n                          └────────────────────────────────────────┘\n                                      ┌─────────────────┐\n                                      │        /        │\n                                      ├─────────────────┤\n                                      │    Datastore    │\n                                      └─────────────────┘\n                                   ┌───────────┴───────────┐\n                          ┌─────────────────┐     ┌─────────────────┐\n                          │     /blocks     │     │   /datastore    │\n                          ├─────────────────┤     ├─────────────────┤\n                          │    Datastore    │     │ LevelDatastore  │\n                          └─────────────────┘     └─────────────────┘\n\n┌────────────────────────────────────────┐          ┌────────────────────────────────────────┐\n│       IPFSRepo - Default Node.js       │          │       IPFSRepo - Default Browser       │\n└────────────────────────────────────────┘          └────────────────────────────────────────┘\n            ┌─────────────────┐                                 ┌─────────────────┐\n            │        /        │                                 │        /        │\n            ├─────────────────┤                                 ├─────────────────┤\n            │   FsDatastore   │                                 │LevelJSDatastore │\n            └─────────────────┘                                 └─────────────────┘\n         ┌───────────┴───────────┐                           ┌───────────┴───────────┐\n┌─────────────────┐     ┌─────────────────┐         ┌─────────────────┐     ┌─────────────────┐\n│     /blocks     │     │   /datastore    │         │     /blocks     │     │   /datastore    │\n├─────────────────┤     ├─────────────────┤         ├─────────────────┤     ├─────────────────┤\n│ FlatfsDatastore │     │LevelDBDatastore │         │LevelJSDatastore │     │LevelJSDatastore │\n└─────────────────┘     └─────────────────┘         └─────────────────┘     └─────────────────┘\n```\n\nThis provides a well defined interface for creating and interacting with an IPFS repo.\n\n## Install\n\n### npm\n\n```sh\n> npm install ipfs-repo\n```\n\n### Use in Node.js\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\n```js\nvar IPFSRepo = require('ipfs-repo');\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpfsRepo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipfs-repo/dist/index.js\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nconst Repo = require('ipfs-repo');\nconst repo = new Repo('/tmp/ipfs-repo');\n\nrepo.init({ cool: 'config' }, err => {\n    if (err) {\n        throw err;\n    }\n\n    repo.open(err => {\n        if (err) {\n            throw err;\n        }\n\n        console.log('repo is ready');\n    });\n});\n```\n\nThis now has created the following structure, either on disk or as an in memory representation:\n\n```\n├── blocks\n│   ├── SHARDING\n│   └── _README\n├── config\n├── datastore\n├── keys\n└── version\n```\n\n## API\n\n### Setup\n\n#### `new Repo(path[, options])`\n\nCreates an IPFS Repo.\n\nArguments:\n\n-   `path` (string, mandatory): the path for this repo\n-   `options` (object, optional): may contain the following values\n    -   `lock` ([Lock](#lock) or string _Deprecated_): what type of lock to use. Lock has to be acquired when opening. string can be `\"fs\"` or `\"memory\"`.\n    -   `storageBackends` (object, optional): may contain the following values, which should each be a class implementing the [datastore interface](https://github.com/ipfs/interface-datastore#readme):\n        -   `root` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at the root (`repo.set()`, `repo.get()`)\n        -   `blocks` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of values at `repo.blocks`.\n        -   `keys` (defaults to [`datastore-fs`](https://github.com/ipfs/js-datastore-fs#readme) in Node.js and [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme) in the browser). Defines the back-end type used for gets and puts of encrypted keys at `repo.keys`\n        -   `datastore` (defaults to [`datastore-level`](https://github.com/ipfs/js-datastore-level#readme)). Defines the back-end type used as the key-valye store used for gets and puts of values at `repo.datastore`.\n\n```js\nconst repo = new Repo('path/to/repo');\n```\n\n#### `repo.init (callback)`\n\nCreates the necessary folder structure inside the repo.\n\n#### `repo.open (callback)`\n\n[Locks](https://en.wikipedia.org/wiki/Record_locking) the repo to prevent conflicts arising from simultaneous access.\n\n#### `repo.close (callback)`\n\nUnlocks the repo.\n\n#### `repo.exists (callback)`\n\nTells whether this repo exists or not. Calls back with `(err, bool)`.\n\n### Repos\n\nRoot repo:\n\n#### `repo.put (key, value:Buffer, callback)`\n\nPut a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n\n#### `repo.get (key, callback)`\n\nGet a value at the root of the repo.\n\n-   `key` can be a buffer, a string or a [Key](https://github.com/ipfs/interface-datastore#keys).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\n[Blocks](https://github.com/ipfs/js-ipfs-block#readme):\n\n#### `repo.blocks.put (block:Block, callback)`\n\n-   `block` should be of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.putMany (blocks, callback)`\n\nPut many blocks.\n\n-   `block` should be an array of type [Block](https://github.com/ipfs/js-ipfs-block#readme).\n\n#### `repo.blocks.get (cid, callback)`\n\nGet block.\n\n-   `cid` is the content id of [type CID](https://github.com/ipld/js-cid#readme).\n-   `callback` is a callback function `function (err, result:Buffer)`\n\nDatastore:\n\n#### `repo.datastore`\n\nThis is contains a full implementation of [the `interface-datastore` API](https://github.com/ipfs/interface-datastore#api).\n\n### Utils\n\n#### `repo.config`\n\nInstead of using `repo.set('config')` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.\n\n##### `repo.config.set(key:string, value, callback)`\n\nSet a config value. `value` can be any object that is serializable to JSON.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.set('a.b.c', 'c value', err => {\n    if (err) {\n        throw err;\n    }\n    repo.config.get((err, config) => {\n        if (err) {\n            throw err;\n        }\n        assert.equal(config.a.b.c, 'c value');\n    });\n});\n```\n\n##### `repo.config.get(value, callback)`\n\nSet the whole config value. `value` can be any object that is serializable to JSON.\n\n##### `repo.config.get(key:string, callback)`\n\nGet a config value. `callback` is a function with the signature: `function (err, value)`, wehre the `value` is of the same type that was set before.\n\n-   `key` is a string specifying the object path. Example:\n\n```js\nrepo.config.get('a.b.c', (err, value) => {\n    if (err) {\n        throw err;\n    }\n    console.log('config.a.b.c = ', value);\n});\n```\n\n##### `repo.config.get(callback)`\n\nGet the entire config value. `callback` is a function with the signature: `function (err, configValue:Object)`.\n\n#### `repo.config.exists(callback)`\n\nWhether the config sub-repo exists. Calls back with `(err, bool)`.\n\n#### `repo.version`\n\n##### `repo.version.get (callback)`\n\nGets the repo version.\n\n##### `repo.version.set (version:number, callback)`\n\nSets the repo version\n\n#### `repo.apiAddr`\n\n#### `repo.apiAddr.get (callback)`\n\nGets the API address.\n\n#### `repo.apiAddr.set (value, callback)`\n\nSets the API address.\n\n-   `value` should be a [Multiaddr](https://github.com/multiformats/js-multiaddr) or a String representing a valid one.\n\n### `repo.stat ([options], callback)`\n\nGets the repo status.\n\n`options` is an object which might contain the key `human`, which is a boolean indicating whether or not the `repoSize` should be displayed in MiB or not.\n\n`callback` is a function with the signature `function (err, stats)`, where `stats` is an Object with the following keys:\n\n-   `numObjects`\n-   `repoPath`\n-   `repoSize`\n-   `version`\n-   `storageMax`\n\n### Lock\n\nIPFS Repo comes with two built in locks: memory and fs. These can be imported via the following:\n\n```js\nconst fsLock = require('ipfs-repo/src/lock'); // Default in Node.js\nconst memoryLock = require('ipfs-repo/src/lock-memory'); // Default in browser\n```\n\nYou can also provide your own custom Lock. It must be an object with the following interface:\n\n#### `lock.lock (dir, callback)`\n\nSets the lock if one does not already exist. If a lock already exists, `callback` should be called with an error.\n\n`dir` is a string to the directory the lock should be created at. The repo typically creates the lock at its root.\n\n`callback` is a function with the signature `function (err, closer)`, where `closer` has a `close` method for removing the lock.\n\n##### `closer.close (callback)`\n\nCloses the lock created by `lock.open`\n\n`callback` is a function with the signature `function (err)`. If no error was returned, the lock was successfully removed.\n\n#### `lock.locked (dir, callback)`\n\nChecks the existence of the lock.\n\n`dir` is a string to the directory to check for the lock. The repo typically checks for the lock at its root.\n\n`callback` is a function with the signature `function (err, boolean)`, where `boolean` indicates the existence of the lock.\n\n## Notes\n\n-   [Explanation of how repo is structured](https://github.com/ipfs/js-ipfs-repo/pull/111#issuecomment-279948247)\n\n## Contribute\n\nThere are some ways you can make this module better:\n\n-   Consult our [open issues](https://github.com/ipfs/js-ipfs-repo/issues) and take on one of them\n-   Help our tests reach 100% coverage!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"5ea1eefd9e87e682b3c852b1cc20a5fbf49c049e","bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"_id":"ipfs-repo-ci-test@0.46.14-1","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"dist":{"integrity":"sha512-l0TN/Ctuj9PaYrcm0dY11cutv39q1YguxwvMOPZfLa7MA9fczL3Mw2duewOvX4hdL9LuEJe0jOocDYkrCK1Bdw==","shasum":"8e1c6b7c08d2eff03e30634c7f8f94e38e25c721","tarball":"https://registry.npmjs.org/ipfs-repo-ci-test/-/ipfs-repo-ci-test-0.46.14-1.tgz","fileCount":22,"unpackedSize":2312286,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbzonzCRA9TVsSAnZWagAALggP/11Al3q6YDnO1RvxdsHY\nissjuDTN2nd2J2a4VWcqjoabDKUB4/p+yMS6OMPMXCpofniFWslHY6E1/GoM\nv9MNI6JWl6I5jY/vgLLTJv2/Xrc2WtSpPamOLa3UTec4kocK+hRtFvxVhxQd\nHJBbeTd/PNJjqTSyRB1MVDeFrx/gL1itfKsNDJXA6efIPPhndXNzvPeqLPkZ\njUs6R6Dyo+YbiEl1tsqsIdss6k2NZWbOzCqAE1ilsdKNfj7CujSJv5h1fx3O\njnHVwaS088/lpkW1hOUPFm0r8U6TidaLQcA2HyxUFm5Ghw97G/ohgoUZ5IAO\niPS3xFEgtEyjlOCKYgdvyljxRhogj37eD4wugbr5C8x2nG0Rh8cfld0rOFaW\n+TfamghlizgMiuDK3cSYS+G4OC7MFo74B65UFm+DmWvsB21bnl+GPHjS61kw\nQD6xH0T1yvvQ6UISQkZ2QqAhUV0/4YlfFTkhG1BQWwx+QxwLuVErSh2Uw8Pd\n68NVmkx57MtD4nyAbMbzj/Z12x71unooS9zyKXXyzCjblbGvhLHAyu1Ff/5C\nP5s1nWPDxOOtQ/6BqM+InHQYLFnC6QyNG6SfpPDBlFPMZuIqZMQodKkbpJkt\njNPFNO4ZKim2QEQ6yk7gq8X/gSVd3x3oB09uWNm7Vi2QszKzYWDJMf+Uj6Ds\nqaXp\r\n=dIFm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIByUV87OyGE2LFWqYJ4Q4JPMsKDp/wqj+Cj7IemgxcQ+AiEApvvqFx1Jig1RvGptTwSJV/O2u2Sc4oL5P+nTMaDvYBA="}]},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-repo-ci-test_0.46.14-1_1540262386659_0.44603409596749755"},"_hasShrinkwrap":false}},"time":{"created":"2018-10-17T16:05:57.470Z","0.24.1-rc.0":"2018-10-17T16:05:57.622Z","modified":"2022-05-06T03:37:04.673Z","0.24.1":"2018-10-17T16:10:16.968Z","0.24.4-rc.0":"2018-10-17T16:29:34.500Z","0.24.4-rc.7":"2018-10-17T16:54:17.598Z","0.24.4-rc.8":"2018-10-17T19:20:40.825Z","0.24.4-rc.9":"2018-10-17T19:27:05.100Z","0.24.4-rc.10":"2018-10-17T19:35:03.192Z","0.24.4-rc.11":"2018-10-18T07:33:41.232Z","0.24.4-rc.12":"2018-10-18T07:40:24.603Z","0.24.4-rc.13":"2018-10-18T08:02:01.475Z","0.26.3-rc.0":"2018-10-18T15:14:27.938Z","0.26.3-rc.1":"2018-10-18T15:36:04.977Z","0.26.3-rc.2":"2018-10-18T16:26:47.155Z","0.26.3":"2018-10-18T16:31:45.289Z","0.26.4-rc.0":"2018-10-18T16:53:10.847Z","0.26.4-rc.1":"2018-10-18T17:00:16.100Z","0.26.4-rc.2":"2018-10-18T17:06:43.390Z","0.26.4":"2018-10-18T17:16:29.640Z","0.26.5-rc.0":"2018-10-18T17:25:25.843Z","0.26.5":"2018-10-18T17:29:13.344Z","0.26.6-rc.0":"2018-10-18T17:38:17.187Z","0.26.6":"2018-10-18T17:40:39.980Z","0.26.7-rc.0":"2018-10-18T18:07:15.693Z","0.26.7":"2018-10-18T18:11:27.143Z","0.26.8-rc.0":"2018-10-18T18:27:19.122Z","0.26.13-rc.0":"2018-10-19T11:09:35.872Z","0.26.13-rc.1":"2018-10-19T11:19:14.567Z","0.26.13-rc.2":"2018-10-19T11:28:54.827Z","0.26.13":"2018-10-19T11:36:00.730Z","0.27.0-rc.0":"2018-10-19T11:42:16.518Z","0.27.0-rc.1":"2018-10-19T11:42:40.563Z","0.27.0-rc.2":"2018-10-19T11:50:47.871Z","0.27.0":"2018-10-19T11:53:47.376Z","0.36.0-rc.0":"2018-10-19T13:09:56.275Z","0.36.0":"2018-10-19T13:13:33.456Z","0.46.6":"2018-10-19T16:29:18.985Z","0.46.13-2":"2018-10-19T17:32:23.064Z","0.46.13":"2018-10-19T17:49:04.440Z","0.46.14-0":"2018-10-22T16:36:39.509Z","0.46.14-1":"2018-10-23T02:39:46.900Z"},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"description":"IPFS Repo implementation","homepage":"https://github.com/hugomrdias/js-ipfs-repo","keywords":["IPFS","libp2p","datastore"],"repository":{"type":"git","url":"git+https://github.com/hugomrdias/js-ipfs-repo.git"},"contributors":[{"name":"Brian Hoffman","email":"hoffmabc@users.noreply.github.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Jacob Heun","email":"jake@andyet.net"},{"name":"Jonah Weissman","email":"jonahrweissman@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Justin Chase","email":"justin.m.chase@gmail.com"},{"name":"Lars-Magnus Skog","email":"ralphtheninja@riseup.net"},{"name":"Pau Ramon Revilla","email":"masylum@gmail.com"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"bugs":{"url":"https://github.com/hugomrdias/js-ipfs-repo/issues"},"license":"MIT","readme":"","readmeFilename":""}