{"_id":"@blockstorage/repertory-js","_rev":"7-f5b04bfd3384aed99af537e50e6b3dad","time":{"created":"2021-05-27T16:35:13.103Z","1.3.1-r2":"2021-05-27T16:35:13.695Z","modified":"2022-04-04T19:39:30.151Z","1.3.1-r3":"2021-06-02T05:26:26.870Z"},"name":"@blockstorage/repertory-js","dist-tags":{"latest":"1.3.1-r3"},"versions":{"1.3.1-r2":{"name":"@blockstorage/repertory-js","version":"1.3.1-r2","description":"A Node.js module for interfacing with Repertory's remote mount API","author":{"name":"scott.e.graves@protonmail.com"},"license":"MIT","homepage":"https://bitbucket.org/blockstorage/repertory-js","repository":{"type":"git","url":"git+https://bitbucket.org/blockstorage/repertory-js.git"},"keywords":["repertory","repertory-ui","library","mount","fuse","winfsp","blockchain","decentralized","cloud","storage","altcoin","cryptocurrency"],"main":"dist/cjs/index.js","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"scripts":{"build":"rollup -c && ./fixup","test":"jest","prepublish":"rollup -c --silent && ./fixup"},"dependencies":{"int64-buffer":"^1.0.0","socket-pool":"^1.2.3","text-encoding":"^0.7.0","uuid":"^8.3.2"},"devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-private-methods":"^7.13.0","@babel/plugin-transform-async-to-generator":"^7.13.0","@babel/plugin-transform-regenerator":"^7.13.15","@babel/plugin-transform-runtime":"^7.14.3","@babel/preset-env":"^7.14.2","@rollup/plugin-babel":"^5.3.0","@rollup/plugin-commonjs":"^15.1.0","@rollup/plugin-json":"^4.0.0","@rollup/plugin-node-resolve":"^9.0.0","@types/jest":"^26.0.23","babel-eslint":"^10.1.0","jest":"^26.6.3","rollup":"^2.50.0","rollup-plugin-eslint":"^7.0.0","rollup-plugin-terser":"^7.0.2"},"gitHead":"841ef34effabf8243c20358f66ecf1bdb659a40f","_id":"@blockstorage/repertory-js@1.3.1-r2","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-T0GkGprZMKYQ4K/hBFX5BvrH8d3WfehSyFqROtOUUoB6Vmz0wnv5awbGtHS+VKBdmCNXM01nPkilF+/WJLf6YA==","shasum":"ba347cefec419faaa390bcba69ed2cf393185734","tarball":"https://registry.npmjs.org/@blockstorage/repertory-js/-/repertory-js-1.3.1-r2.tgz","fileCount":11,"unpackedSize":6614611,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgr8pBCRA9TVsSAnZWagAApCcQAKKNBHVwqdI5jMD8O+v8\nd+FrsEM7lFxvihwdWbeL1+8NiM+CkE1ilUstwuIcnM5tTgqU2Ifo9byn8YdY\nT9hu0ksaPNYJBMN6KbwTp9oUBTwkeCJU1t9IX/39OMjEl37K1+w+Qx2KdNSd\nxyj5UZUiFOCULf5sH0QRsQ2ua0yOI986Ak9Sh1P85c2YMCLn31auLBjUBON8\nedJeQ17BweeON1LzkBTnDiMb62wzkaiw8ggnZpag3qmKF1esdrq8mi6h64zN\nKHg0Je/D6xsUB2nOriSfwxWAmDd8YcFpFxCAEQmxMmLHS4UEi0o+o0Q3bc/V\n0ckikkmfD0Wg58MAJROr3GFFWJhKNNwxrVS+eb+3OZCPj1xcxzwZD91ICMFn\nk38//9yLLnHLyHAKbv7owzEAVLbpE32sPJTGoucmkx7AEeLDWWXUTKQT0tHy\nHswSL2rqf9XWYiG1gfowGvEkAc+Q8aC843DkNqsresuTZlxj8Ya6vwxpAaSK\n1AEueA7yQg3hngMdKVYVwN3mT2l2feZjGsaMOU2S6Odoe8gEXfST/lSDNqMe\n7pdfXa1HyhLsU7X4lCB2fNYR3H/BeqSfFczZ9RJaG2z18BpVz53Aqaw47rz6\n/bQyxcHfwL8JxcGPdQkPzyyYt+3shaPxqY9mk7rzMwwoNabYtU+uLdpiuBQF\nq4Lk\r\n=AjMA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB+LWfQUiRP5mqS7xjtPilwTPh6Uc+60FFWOsnGkxlgqAiBqLT7IVzAKJMZz/wlAhY+nMMQR00YWLR6hw+qqLQLByQ=="}]},"_npmUser":{"name":"scottg1","email":"scott.e.graves@protonmail.com"},"directories":{},"maintainers":[{"name":"scottg1","email":"scott.e.graves@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/repertory-js_1.3.1-r2_1622133313437_0.3326041653431746"},"_hasShrinkwrap":false},"1.3.1-r3":{"name":"@blockstorage/repertory-js","version":"1.3.1-r3","description":"A Node.js module for interfacing with Repertory's remote mount API","author":{"name":"scott.e.graves@protonmail.com"},"license":"MIT","homepage":"https://bitbucket.org/blockstorage/repertory-js","repository":{"type":"git","url":"git+https://bitbucket.org/blockstorage/repertory-js.git"},"keywords":["repertory","repertory-ui","library","mount","fuse","winfsp","blockchain","decentralized","cloud","storage","altcoin","cryptocurrency"],"main":"dist/cjs/index.js","module":"dist/mjs/index.js","exports":{".":{"import":"./dist/mjs/index.js","require":"./dist/cjs/index.js"}},"scripts":{"build":"rollup -c && ./fixup","test":"jest","prepublish":"rollup -c --silent && ./fixup"},"dependencies":{"int64-buffer":"^1.0.0","socket-pool":"^1.2.3","text-encoding":"^0.7.0","uuid":"^8.3.2"},"devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-private-methods":"^7.13.0","@babel/plugin-transform-async-to-generator":"^7.13.0","@babel/plugin-transform-regenerator":"^7.13.15","@babel/plugin-transform-runtime":"^7.14.3","@babel/preset-env":"^7.14.2","@rollup/plugin-babel":"^5.3.0","@rollup/plugin-commonjs":"^15.1.0","@rollup/plugin-json":"^4.0.0","@rollup/plugin-node-resolve":"^9.0.0","@types/jest":"^26.0.23","babel-eslint":"^10.1.0","jest":"^26.6.3","rollup":"^2.50.0","rollup-plugin-eslint":"^7.0.0","rollup-plugin-terser":"^7.0.2"},"gitHead":"0d26bc8f03e03557f2ba6fc5abb00d09ed51cfbc","_id":"@blockstorage/repertory-js@1.3.1-r3","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-SO0zm+hoixvMrLPxkJz970GWi01GroVXPo6k5sSpEA1wWTqgSdkg1N90/CDjqOPByPyiS0oTgOdcDyzt02jLKA==","shasum":"86351279e7e823602eadb9754a1f75c91819f56b","tarball":"https://registry.npmjs.org/@blockstorage/repertory-js/-/repertory-js-1.3.1-r3.tgz","fileCount":12,"unpackedSize":6637161,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgtxaDCRA9TVsSAnZWagAAI6kQAKTJHB+yzQ4q1rInmfUa\n/1WqLqMV6vK/ed7t4zjWSy7tvSTdtquW7EfueLKyjobs6XbfphCxo/33K/K2\n1r+nXnzVWyOyh2KvR0EFmI5CseLre08z+m4EasGgbl7RWBum5dHpBi51k7e9\ndBBfFV893aShB7AOg8IZp8xW9KSyGfc3iU1UYbP9bqtXSQxDM3pMEn6INZF5\nQEZE9gHAGTO9mtkLTD/yyjAdHeLsgS1dADTlCxRGwDGAKuXCzSDQPHDm8EJo\n3bfdgIRUGDFBwCfe8l2IV1dQqauJIWXIZnugEkNNVtZO3kK79XoJiJC0lLz9\nqNErIDdoYGfK4VCtGKb2twixiwfCmmDsQGD045zMM3nEKHp1dj02fQiyy0TM\nzoxZVWt+NRdWp45HhEf1NCCjslQESqxTndxeNOG+JDPXVHnBpRnWCJoKvP4D\nbHv3X2r/s7VAtiC6bh8Os81ahCA98lvu6RP7qYsQxo39BQgSbfHufchU/tWS\nX1sTUtGm4X93iYssgSPouS5kjXLV8ic+nPeaFNj310svlezZw3hxixcQjpSu\ns8ElpOoDMdKcUwrSSr0DOso2Xoowm9jHFFWw5Fa2Rafa/Vz42g+gI+WGh34q\n30m3q8GEAIfhZbl4KPjn3EsHL2L4IEjxruvEDubn3soV1tqXeM1d0BChgLMQ\nIE/w\r\n=nN4E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCZa3vhm3OtR62RC5gE70DRlga3ZkCi/wrPjeGku11XyAIhAOHpT8HY6yYXHyLbO14ao/QbDbQPTArjjx9P0UM6CKxM"}]},"_npmUser":{"name":"scottg1","email":"scott.e.graves@protonmail.com"},"directories":{},"maintainers":[{"name":"scottg1","email":"scott.e.graves@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/repertory-js_1.3.1-r3_1622611586681_0.8922969918214361"},"_hasShrinkwrap":false}},"maintainers":[{"name":"scottg1","email":"scott.e.graves@protonmail.com"}],"description":"A Node.js module for interfacing with Repertory's remote mount API","homepage":"https://bitbucket.org/blockstorage/repertory-js","keywords":["repertory","repertory-ui","library","mount","fuse","winfsp","blockchain","decentralized","cloud","storage","altcoin","cryptocurrency"],"repository":{"type":"git","url":"git+https://bitbucket.org/blockstorage/repertory-js.git"},"author":{"name":"scott.e.graves@protonmail.com"},"license":"MIT","readme":"# About\n\n`repertory-js` is a Node.js module for interfacing with `repertory's` remote mount API.\n\n## Installing\n\n```shell\nnpm i @blockstorage/repertory-js\n```\n\n## Repertory Configuration\n\nA Repertory mount must be active with the `EnableRemoteMount` setting enabled. `RemoteToken` should\nalso be set to a strong, random password.\n\n### Enabling Sia Remote Mount API on Windows Systems\n\n```shell\n    repertory.exe -unmount\n    repertory.exe -set RemoteMount.EnableRemoteMount true\n    repertory.exe -set RemoteMount.RemoteToken \"my password\"\n    \n    [Optional - change listening port]\n    repertory.exe -set RemoteMount.RemotePort 20202\n```\n\n### Enabling Sia Remote Mount API on *NIX Systems\n\n```shell\n    ./repertory -unmount\n    ./repertory -set RemoteMount.EnableRemoteMount true\n    ./repertory -set RemoteMount.RemoteToken \"my password\"\n    \n    [Optional - change listening port]\n    ./repertory -set RemoteMount.RemotePort 20202\n```\n\n### Skynet and ScPrime Mounts\n\n* For Skynet mounts, add `-sk` argument to all commands listed above.\n* For ScPrime mounts, add `-sp` argument to all commands listed above.\n\n## Module Environment Variables\n\n* To successfully complete unit tests, a `repertory` mount supporting remote mount needs to be\n  active. Set the following environment variables prior to running tests:\n    * `TEST_HOST`\n    * `TEST_PASSWORD`\n    * `TEST_PORT`\n* To override the version being sent to `repertory`, set the following variable:\n    * `REPERTORY_JS_FORCE_VERSION`\n        * NOTE: This variable is primarily used for debugging/testing purposes and should normally\n          NOT be set.\n\n## Example API Usage\n\n```javascript\nimport * as rep from \"@blockstorage/repertory-js\";\n//const rep = require(\"@blockstorage/repertory-js\");\n\n\n// Repertory host settings\nconst MY_HOST_OR_IP = 'localhost';\nconst MY_PORT = 20000;\nconst MY_TOKEN = 'password';\n\n// Progress callback for uploads / downloads\nconst progress_cb = (local_path, remote_path, progress, completed) => {\n  console.log(local_path, remote_path, progress, completed);\n};\n\n\n//************************************************************************************************//\n//                        Step 1. Create a connection pool (recommended)                          //\n//************************************************************************************************//\n\nconst conn = await rep.create_pool(8, MY_HOST_OR_IP, MY_PORT, MY_TOKEN);\n/* Or create a single connection for light operations\n  const conn = await rep.connect(MY_HOST_OR_IP, MY_PORT, MY_TOKEN);\n*/\n\n/* Disconnect when complete \n  await conn.disconnect();\n*/\n\n//************************************************************************************************//\n//             Step 2. Create an 'api' instance using the connection pool / connection            //\n//************************************************************************************************//\n\nconst api = rep.create_api(conn);\n\n\n//************************************************************************************************//\n//                                      Step 3. Use 'api'                                         //\n//************************************************************************************************//\n\n//------------------------------------------------------------------------------------------------//\n//                          *********** Directory Operations ***********                          //\n//------------------------------------------------------------------------------------------------//\n\n// Check if directory exists\nconst exists = await api.directory.exists('/my_directory');\n\n// List directory contents\nawait api.directory.list('/', async (remote_path, page_count, get_page) => {\n  for (let i = 0; i < page_count; i++) {\n    const items = await get_page(i); // Always 'await'\n    console.log(items);\n  }\n});\n\n// Asynchronous directory list\nconst snap = await api.directory.snapshot('/');\ntry {\n  for (let i = 0; i < snap.page_count; i++) {\n    const items = await snap.get_page(i); // Always 'await'\n    console.log(items);\n  }\n} catch (err) {\n  console.log(err);\n} finally {\n  await snap.release();\n}\n\n// Create new directory\nawait api.directory.create('/test');\n\n// Remove existing directory\nawait api.directory.remove('/test')\n\n\n//------------------------------------------------------------------------------------------------//\n//                            *********** File Operations ***********                             //\n//------------------------------------------------------------------------------------------------//\n\n// Check if file exists\nconst exists = await api.file.exists('/my_file.txt')\n\n// Delete a file\nawait api.file.delete('/my_file.txt')\n\n// Download a remote file\nawait api.file.download('/my_file.txt', 'C:\\\\my_file.txt', progress_cb);\n\n// Download a remote file and overwrite existing local file\nawait api.file.download('/my_file.txt', 'C:\\\\my_file.txt', progress_cb, true);\n\n// Resume failed download\nawait api.file.download('/my_file.txt', 'C:\\\\my_file.txt', progress_cb, false, true);\n\n// Upload a local file\nawait api.file.upload('C:\\\\my_file.txt', '/my_file.txt', progress_cb);\n\n// Upload a local file and overwrite existing remote file\nawait api.file.upload('C:\\\\my_file.txt', '/my_file.txt', progress_cb, true);\n\n// Resume failed upload\nawait api.file.upload('C:\\\\my_file.txt', '/my_file.txt', progress_cb, false, true);\n\n\n//------------------------------------------------------------------------------------------------//\n//                       *********** Low-Level File Operations ***********                        //\n//------------------------------------------------------------------------------------------------//\n\n// Create or open a remote file\n{\n  const f = await api.file.create_or_open('/my_file.txt');\n  await f.close();\n}\n\n// Open an existing remote file\n{\n  const f = await api.file.open('/my_file.txt');\n  await f.close();\n}\n\n// Write to a file\n{\n  const f = await api.file.create_or_open('/my_file.txt');\n\n  const b = Buffer.alloc(1);\n  b[0] = 1;\n  await f.write(0, b); // write '1' byte at file offset '0'\n\n  await f.close();\n}\n\n// Read from a file\n{\n  const f = await api.file.create_or_open('/my_file.txt');\n  const b = await f.read(0, 1); // read '1' byte from file offset '0'\n  await f.close();\n}\n\n// Truncate / resize file\n{\n  const f = await api.file.create_or_open('/my_file.txt');\n  await f.truncate(10);\n  await f.close();\n}\n```\n","readmeFilename":"README.md"}