{"_id":"@skalenetwork/filestorage.js","_rev":"45-8a80375b902e3b01c21eb76c365e64d3","name":"@skalenetwork/filestorage.js","dist-tags":{"develop":"1.0.1-develop.7","beta":"1.0.1-beta.0","latest":"1.0.1"},"versions":{"0.2.0":{"name":"@skalenetwork/filestorage.js","version":"0.2.0","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.0","maintainers":[{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"}],"dist":{"shasum":"0562acc83eba0133c64160f5ed389956429b3b0b","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.0.tgz","fileCount":25,"integrity":"sha512-7bY/xHwuL1YvWR4oaFg3tZ1uiW1yR1tXyyDUIeHvHAMhyUb2gVh96mng+QVeJjV/QX2duS4xwUkdgGr8jgxhtw==","signatures":[{"sig":"MEQCIHM3dMMAO+8wdESEWW1TQjrZGLFVHXjX3cqWIvZLHbAOAiAfzh/yZY1WUkJl+Z0d/gOquMVuwJ7VQfTIFRJnUWY0Qg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1024850,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcuIY/CRA9TVsSAnZWagAATjcP/R/47Kr7FsgLRyJvBzKx\n9xzkf6e0kUabyMEW+YZOs5qDNxloCS+um9xcPPuUWGA8uqKv7Kvk1DBDd5My\nZvQnC216lxQVBZlweZE0TW1bdp48kRnI3/dNd0/CYZhu6IsjEuNgSD2uH0rq\ngemIkN9EHTr5cczr3VevOajxlSAVKGUluz1lRyZMiGvvDhM7Ri+imEhYQRkr\nkmYSUAXgemDawXMYE+dEqWAMZV1tjNd/mWDQkm92HbyAUxG2b7+6ofd2CSYN\n0w5URuBda/ksMGg/Z1BXXV2h9fMeNW3qyudgTM/xDHrMOEvQhuV7aMq5k4Cg\n3h/n9868R+KJEWY5L/WEZVRDnpFEqSejg16rOtuXZJ1EoAZFPUxanfS5DDaI\nrWTKLmQ+EHq9XeIo9gHzPW4d/01Xfcyz4gUNhn6Gk91GE+3ZmWsJ95R1YZTq\njuj0Cdzk+6+KFWsbL8HaRPLPfhqItXlEcxBYyyZEuUfYeSYnYAu4GuxyrFhg\nGtP4oTfbNviAio0E6uZf/8BQNIlf0rfhzZmj522lDCMDgmaTAyZs9IvYD7W+\ntRZei229f1ionQEYvtsP3XWBdwGEasDU6GjP25mCGWGgAbR33wc9PBWjloIT\nojmxNZyyZFDB2jmCWdEZ95ljohtX25Xp1gpsKnhiiKPLBve1q1Lk3OLN+Oq5\nqcUE\r\n=lrQ0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/filestorage.min.js","gitHead":"2b5bfb8080e1de4d54e8210e2c84009b174b0e53","scripts":{"lint":"eslint --cache --fix src/*.js test/*.js","test":"mocha --exit --timeout 20000","prepush":"npm run lint && npm test","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.0.0-beta.37","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","mocha":"^6.0.2","dotenv":"^7.0.0","eslint":"^5.15.3","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.19.1","istanbul":"^1.1.0-alpha.1","webpack-cli":"^2.0.12","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","randomstring":"^1.1.5","eslint-loader":"^2.1.2"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.0_1555596862360_0.6067462160157739","host":"s3://npm-registry-packages"}},"0.2.1":{"name":"@skalenetwork/filestorage.js","version":"0.2.1","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.1","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"dist":{"shasum":"535bab39ab05b8e58a5de3e74ecb423084d6bb1f","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.1.tgz","fileCount":25,"integrity":"sha512-62CLtII7uiACSHQIsr9IcBFwfYZnZZIFwMQzBBLxTMs7WhIt+3iEu9LwqOAQhlWMsWlL9P/loLmbKns37SS+9A==","signatures":[{"sig":"MEQCIFv8/vep4tZTMvS5hPBFDoKlz4V7ETtAH9ZBuDwDuuvUAiByw8CmsvwTmHyKDGkSD7nly85yeAIHoo7fkzLrBMk6Ag==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1024850,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcuIl1CRA9TVsSAnZWagAAm+oP/RFqmBEqtyT6sfawRJ0W\ngdJH/E0CeZf6z4r7c2fx6mS0CV7b+unF0/uoipO79ujq7ZmwC2K0M5y8V0uP\nCHGg3F6T1opOngPM80sldNP70i62xes33J9NC0ml9xwOCSI1RFywz9YcW/ul\naSNFuxG1m16uhON4zkehTWwnlsWqwMmVoL+Vw8EJYeLLXUskt+SBXNIiZNE4\nMi2Qt2C6fMkQQSYzR/Jkf0TpLozt8S0LgQXcKGRW0e/ff1tBg1tRVVga12ho\nubAl6aPVa3rNYhB4CQKXH25qgrfC29D6I77SJ8pWUOjIS4OWWpcPsjBbAmYb\nCNAupTjIPw0+dQo7+mS0qEJeK19wOEusRCu5YmGfGPVfSUQDZWCUyO3E72pe\nQ4mX5jF0HheLz9ULqPVu2oBb1+sCdEFVey85y5sjQGFVYLxXpwt+AydM6yE0\nh0OOGTpt+8wBaOibrFdoLfzpFLaLxVz6uEcrpXmzJLdRa7UiOx4cB50hZNod\nOTB7SVVke3fL7naA/sviGHQqSq7cmuoZGpBW+Nux+VF/JVhcD7xPogV8QJnr\nGQkLg/ryUAEozjXnF7UKCHasYpF/3b2cv8JL4A4o6HjrtWL/B1O8IPamwH5W\nZq6iB6etLwBrbpiizCA8y7rK2xWTzMe1HbKzBLFBFCGEIqzcGgMPzdMkunEn\n73iX\r\n=yGnB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/filestorage.min.js","gitHead":"1cd6010ebb7f0c1cea636a0595e2630dba0fa2ce","scripts":{"lint":"eslint --cache --fix src/*.js test/*.js","test":"mocha --exit --timeout 20000","prepush":"npm run lint && npm test","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.0.0-beta.37","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","mocha":"^6.0.2","dotenv":"^7.0.0","eslint":"^5.15.3","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.19.1","istanbul":"^1.1.0-alpha.1","webpack-cli":"^2.0.12","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","randomstring":"^1.1.5","eslint-loader":"^2.1.2"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.1_1555597684229_0.9274938029863289","host":"s3://npm-registry-packages"}},"0.2.2":{"name":"@skalenetwork/filestorage.js","version":"0.2.2","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.2","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"86998aec942e6c70ecf6f855813f9f7666ec8209","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.2.tgz","fileCount":25,"integrity":"sha512-SLe3LlKQWMebqNBIrdjUqRwT+QdPNJYJIQBX+zUDTTSlAwVTcpg8mYwXIVlqfno9KSTarMiRsjRKpupTiicISQ==","signatures":[{"sig":"MEUCIE7mPDT9sOH2v5gRx7BhlJXr1XPvO1EuxitQPuX1/xQHAiEA194FJouP8rqXGzuaS/Gg5AG3Kkd3UkVGAnH8XZr/Xok=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1025115,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcubyQCRA9TVsSAnZWagAA1AoQAIl1muZe/nX2nzomq1iD\n1msXujA4z+e7ttYdAk3I5xIHweXpd02o+RXcYMDv27YfzPC1nf2coB4HQo1M\nWAFYgSDr6jTTqEe5mvX4a9L+ID6HP3j8nadYabYnYVbbyOZ6QjUrxywT+yT2\n/SdMKSCTnbHy49o60y/1DGDyOYihBQOL12PO1gqlfepIh5Ica4ifPUvyCOHW\nDWaQUpyrDL1uqBzPNdJfvpg+SvA6SC54gjQJep48TqS/7Vwq7MJWG/w3Es8D\nYOWEK6pRkDRUZoOHHXMRmI0luGFuPbaAUUpW+mgEuV6tw2ng7etWwyO7EI57\nFepfFlHYfS3Q+64L03dvYwKL0mGAnx8UATuiCRH9Q7RfoGxPir0OVUaEJPoG\nZsHtoKl5TI0fYJ46MHNleMLhlzN3pz/WIBkA34O394WWcQ9dbjBjzZQoQ1hl\nlLZ8JPDVJWHH9TiOZvsPtbTPROrBIcpP/XG1rj6B5eeXjVfKpVsPoYvymjRj\n3tTw5ZTBlmHDOehyObqKC20nbZ6MWXeAUq5742KmzgDEdzaPqLDIgDViDLkr\ngzojWq3QoaPdxSNdSlH+bXycK+3BF9/tcH94Lnz6UfaFJTqFmR5MdzvNYdjH\nimerVe4y9HrakpFico2OcxVRyKnueR6TVghDJMCJDX3NgFx1aA9yDs8BuedE\nE6oU\r\n=Cpht\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/filestorage.min.js","gitHead":"2fd660d33daeaf0c3fc06b731ae9b5f5a319383e","scripts":{"lint":"eslint --cache --fix src/*.js test/*.js","test":"mocha --exit --timeout 20000","prepush":"npm run lint && npm test","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.0.0-beta.37","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","mocha":"^6.0.2","dotenv":"^7.0.0","eslint":"^5.15.3","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.19.1","istanbul":"^1.1.0-alpha.1","webpack-cli":"^2.0.12","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","randomstring":"^1.1.5","eslint-loader":"^2.1.2"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.2_1555676303246_0.5904762798985668","host":"s3://npm-registry-packages"}},"0.2.3":{"name":"@skalenetwork/filestorage.js","version":"0.2.3","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.3","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"a2e3360f221f51da12e358480fb6db2d357a4638","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.3.tgz","fileCount":27,"integrity":"sha512-9qyndWpNHnQuBcCxXCf/uNu2Yz/1LYIvJCU5ogjxFcLk53NGyikrsTFmtNOV5PAAVJOqKEgfrLoECJP0156OGA==","signatures":[{"sig":"MEQCIHTAlX/NGMfCSd6KhR3CyYBLiqWM1NXjZ/atuF9KGwRpAiB08aIR+oR4CGTv8BbcD5cENTk7OYVtmAk2XxazaXs+jQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1053588,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdXVfqCRA9TVsSAnZWagAAq9IP/0hKa4zs9ZzFQfL2FDR9\nkId9wiHu05hh24ubr1bOVlJqE9jWyzD4P8nf36tkX3na199q3FoEMUcy7zG/\nzj0XGpKvKGymgM1Z7gdDLP6GkJ9oMfkoad5vt4W8nnjngZieNbCssmMu9vl5\nMHvGCPYW6p4DBzvm85QR4/tDdiBE3GcPVKCLea/a5Cnz7pw1uZgJBVcZ7nAX\nshaFxpJXykmzWpU0DOohp47IFCW0Tpi+NwgWBwJD38eOw9CqyA8G0qZB3/ap\nHUwPUJXQSBiJE2V2AWmNv161Ctu7KIZ/xHZ/GbmFTNPfgu9NwSQdCf5NaCVA\nJigw1LjJp3FFeKbkebmMjpkDUYVIMic5U+6fYxdyUVXUOW8dJ9FYibj5tGau\nHlxXFAnjwfk2J/pmS9wU8Jg7gpq10pszQIyCaS4xoLlXpHnw/yFZu2LTFVup\nqeuPm9xDoJHaQ9BdcQZqzmLkkFNC0X1sUdXY8jK7Aq89sCkLjgrleThNKygJ\nImnvS4rxysPEucn3idsm9+HIb6q0ymzRBtoMe6L1L82UwewHM+Lz1WH0xwzK\nycavnJej9tP+HOEFXdXwQXB04bkcNpfwU0TR0NSRw/dnBXkro6FI3l+6TOww\nJzKImMktNMVS2+NfRwreBM2ED0yWIcNWRlzOd3Jic3zQ10pw+VW1PO4MbXgx\nUq4O\r\n=TkRy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/filestorage.min.js","gitHead":"6cc3c83396e43391f27a71842b9b6a13eda6970d","scripts":{"lint":"eslint --cache --fix src/*.js test/*.js","test":"nyc --reporter=lcov mocha --exit --timeout 120000","prepush":"npm run lint && npm test","coverage":"codecov","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh","generate-win":"IF NOT EXIST .\\test\\test.txt fsutil file createnew .\\test\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.0.0-beta.37","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^14.1.0","chai":"^4.2.0","mocha":"^6.1.4","dotenv":"^7.0.0","eslint":"^6.0.1","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.35.3","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","randomstring":"^1.1.5","eslint-loader":"^2.1.2","chai-as-promised":"^7.1.1","eslint-plugin-jsdoc":"^4.8.3"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.3_1566398441883_0.5542098686633066","host":"s3://npm-registry-packages"}},"0.2.5":{"name":"@skalenetwork/filestorage.js","version":"0.2.5","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.5","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"91bad7cb33695ca65de3d902097100b454bfcadf","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.5.tgz","fileCount":27,"integrity":"sha512-eQ4WhcsaSn3NLG2Ebx+2EdFcFtvQxIAM6BWLC2HlEYXIGvHRpxS2A3CxcBsiq8Y9Rp68eyLyVdBFJZcGxRYdGQ==","signatures":[{"sig":"MEUCICbWhOZnDNeJ+1myqR/YptaDknXld2Cr7m/YpZNf4PLuAiEAiAV6oyt4OYVVSMNWOr9AYXdwTG7tIpzW5GWa0WG/ya8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1053673,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJddCTbCRA9TVsSAnZWagAAOHAQAJiDNh4Nzs/6yHqrgr7C\ngji/XQJ9JS71IQ+3YifBGEXaBbklbR+kdXozUYSmcUHn+l/Hyhva3gCcpk/I\nH6IRbfN4ofQn8wcr9D+hxl8LCfu44tZVnBe9r4jF2nDutN/T9DdCSC4WT8yl\nAPIgen9grzPJAb8/cjE3p/bhAdAFFWB7uOU/rjuJvbOQg9UhLJgA41ZO4Cld\nkueFz06oAdaOMNwLd4jVs/1RDptsCy1yF7egSAtIkCrvqIjvPym/r1qVr9ek\nQuIqQ2YKUZt2rBgz0loXyncgunA1RrUnn9YVeSnlTwzxs12IsSTCNqOmmJax\nHP//YG13zUO8I73WjqnUYcvrVdJQg5gtRqZx2S1ch57MkKLOshTO2J5le79t\nfwWPi2AhwrkpiIzxd+++KoIiaQrFrU2QxZIP/RE3mfObAJWD/MkNejMJpFz7\ng3iKJSnqRnpO2XQ6tQwWpLReBt1xL9HRY4VSpkj26Y6R1n82DVlea2NPr5pd\nPWFET0UzZG4y3uHjMn6++Xw5xoxhCrlrmUJa892TvjnZldSs3R8YE2Er5Xdi\nHdGYrVsh3GCDIkErKlJRd58RxHu0co0nT3zKzeMPO0XgTFjq5ON5wTJmjYjJ\nHynUPXOOy1a1w+xR6OJBUSLTbsPd0p0MAo74CZ+2qqEbaXhG23nTjUajlwUb\nV+AN\r\n=i6sU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/filestorage.min.js","gitHead":"25d8dfbebe5a799babbf6594f1f7731c0a85fecf","scripts":{"lint":"eslint --cache --fix src/*.js test/*.js","test":"nyc --reporter=lcov mocha --exit --timeout 120000","prepush":"npm run lint && npm test","coverage":"codecov","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh","generate-win":"IF NOT EXIST .\\test\\test.txt fsutil file createnew .\\test\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.4.1","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"8.16.1","dependencies":{"web3":"1.0.0-beta.37","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^14.1.0","chai":"^4.2.0","mocha":"^6.1.4","dotenv":"^7.0.0","eslint":"^6.0.1","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.35.3","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","randomstring":"^1.1.5","eslint-loader":"^2.1.2","chai-as-promised":"^7.1.1","eslint-plugin-jsdoc":"^4.8.3"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.5_1567892699042_0.7475888817989746","host":"s3://npm-registry-packages"}},"0.2.6":{"name":"@skalenetwork/filestorage.js","version":"0.2.6","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.6","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"676049ae5d9322ddee63fedd669aedae8fd26c61","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.6.tgz","fileCount":27,"integrity":"sha512-Jg2940HzfaIl9fkqHQjx08VIQ1EtCb7/SQnnMmrkVCPYmoo8cVryl5juWjSxtWhH/7+Tyz3bolZ/CWnJJJ5+2Q==","signatures":[{"sig":"MEYCIQDt7ofBEiZoUf1ydKg7+vi2AO7yvKdVD96bycI0thd8oAIhAIHZidZcwLL+YcUNrI+s5z9JxiGM4iHNl33syFJMttR7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1051186,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJddlvlCRA9TVsSAnZWagAAiJ4P/20XQAQrgh44xyxZGO/f\nVM5U4+B3aqGqwsRfuiYUWws74fROJACvDLM292LTtN49mTlE03yxa75Ge6P1\nQ9Hi0uGhDv0aDhx7gm/EKWuL9JZh/M2AOIdgEYSiIUAJnEjclRU/QBIDTxv6\n9SuazYPD6AEizPNceblHnGQgEYdCoyMr6PAjiJIvIhldI0yvwHUm1wdFBjZw\noFbFSfZKbQHqNGmSQy+obVA6kToNnX93lE+P/zkkOGYZ66/sK+IjVn+lESH1\nsdkEunX9eVN6alpeB0WceK12keFNbsQLO7Grm4Pewvs34AkGsbxoPYyezyuX\nm724zWvLRulQjOQqzzPkdyW3jO/wO4J+wWK1AGzWDtYjoBgglipKvsajqBn+\nqo5FUU3EPiDW92W54UrD1ql0q8QaPCITkjwWawcj+qa3xH20FHatz886z5I8\nkYSM5F4juoe+dxYQw8Xtnx5NegYfF5apmDu200vbfjJgZwe4bOpSCgdKvQRs\nRpT+yGIZS4D0mWWhgzOxLVTEZUzIj6wVOLFhLXgfzGG+M2e+pFmor+QafwP0\nsTIvVVISUYgieiYAb+IDvXOeFOC3FUW48GKeQ7Bqe9oaNfNJkDVTfK1fDcFS\npJNvTo8cFu8htkV4oAjrDLHCKX5cYs2pUC2n34Qy3Hw6ZJN7U/Gk6FNY99nG\nqKIg\r\n=ZE1q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/filestorage.min.js","gitHead":"aa5ce60c7f470b1dd69229ca7d8ab8130314b01c","scripts":{"lint":"eslint --cache --fix src/*.js test/*.js","test":"nyc --reporter=lcov mocha --exit --timeout 120000","prepush":"npm run lint && npm test","coverage":"codecov","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh","generate-win":"IF NOT EXIST .\\test\\test.txt fsutil file createnew .\\test\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.0.0-beta.37","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^14.1.0","chai":"^4.2.0","mocha":"^6.1.4","dotenv":"^7.0.0","eslint":"^6.0.1","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.35.3","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","randomstring":"^1.1.5","eslint-loader":"^2.1.2","chai-as-promised":"^7.1.1","eslint-plugin-jsdoc":"^4.8.3"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.6_1568037860893_0.15846500986988588","host":"s3://npm-registry-packages"}},"0.2.7":{"name":"@skalenetwork/filestorage.js","version":"0.2.7","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.7","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"ebe6c85158dcc4253b8298d28661eefe2bf8a02d","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.7.tgz","fileCount":28,"integrity":"sha512-iuP9R3deayj90jBolDxoVkb8SoBus7+0YQ1op1jNBgSPmjy6FV+Wybsei9gz9ydjaAvSmMmxiWHwW389P1/7xA==","signatures":[{"sig":"MEUCIGe6jbUucIl/gqUDNeInXAByXmlR4ZmX24VQU9XtS7s7AiEAkiPsUSl9+jOot771JxIfFEKxW3ibtSrsoCyo/J1JPoM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1054006,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdhMlWCRA9TVsSAnZWagAA1iQP/1DOiw4jsbd1uAC59DvZ\ntD+mXrG0XUTjJR2GWG8x3feY0a+4F42xcDmfcQ5uRxJytOXfoWis41jDhjQl\nVdR4aFKrKf7CiIeLlVwEzCEZtC8MDDKry6ItMrlu+CWSwBDPhrGAYL4TzSzg\nzZaybRRIfF9pNGWodHtk4CG/veCOrv+BkonZLk4shO4ns9jvh0fkCal7dKGD\nmiclJYhG1TbxhXql5jXv5mbLTr8gYMqJabsgdkxm5bp2ihVXSVWvgAE5xVg+\n8ES8oCWfStvLVMfzXWjYn2TDkHjKDxPqL7YUThbopp1KlLYWB/0ETYquwhzt\nMFPiLU4P9VOKNUYa+F8YzEBoL4Mk83FLZKobCFtq+aej5NENqqq0kQSDuLiE\nhJVlB+tGYPBgRVSb84/BFqCSHETtpsvOqStigfJ3zwoSntk2UmnxmcDiBQ/e\ntH7XdsJAtgaUBsLSprkT2z6H9L4Quon3Mzmrzr+DzVzzXYKSxNvXl+XoE41e\nTuTvtK+6MeCDksBbn886hifQNMpTHuXJMNvSDv7Gi82JtW5Ke3n+Z+bQ9Onq\nzAmuEujIpXbrygpn4uwCKua7Dfw/7SBoXDcqWIRBVoInjFuZQXzP9q754Kl2\nAGLDeJHjAwzh7x0Dp0+Zuy9g2X52DtvNutD/zN460/eRiN7HfacVgcpaub41\n0vl1\r\n=aObW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/filestorage.min.js","gitHead":"29cbdc8e5db33a29d473dc521d0ba17ba20b93af","scripts":{"lint":"eslint --cache --fix src/*.js test/*.js","test":"nyc --reporter=lcov mocha --exit --timeout 120000","prepush":"npm run lint && npm test","coverage":"codecov","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh","generate-win":"IF NOT EXIST .\\test\\test.txt fsutil file createnew .\\test\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.0.0-beta.37","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^14.1.0","chai":"^4.2.0","mocha":"^6.1.4","dotenv":"^7.0.0","eslint":"^6.0.1","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.35.3","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","randomstring":"^1.1.5","eslint-loader":"^2.1.2","chai-as-promised":"^7.1.1","eslint-plugin-jsdoc":"^4.8.3"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.7_1568983381403_0.7320340529218146","host":"s3://npm-registry-packages"}},"0.2.8":{"name":"@skalenetwork/filestorage.js","version":"0.2.8","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.8","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"72f849cf559c8c21b6c03743d019f68b04701548","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.8.tgz","fileCount":35,"integrity":"sha512-wbB+1Kg4LUQwqJ+LuLdnsI71Uh2VmKZNhNcPLcMDDXeABzJVk5czQhmCPN3c+dVah5rtwqpJidZbb45PFfvrkQ==","signatures":[{"sig":"MEYCIQDASxFzYlGZoRGo/uizz8onIFi0op0uRGduLy1dsUmHPgIhAJXitqT+woWwnkg3lKMcpzib3yr1HHVOKhrAoXSq9+s5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9887019,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdxDQmCRA9TVsSAnZWagAALNgP/1uFzsx7/JMkzgpTF05R\nKhCZzNTgKgLECtlHjB6bXgN5lQ1u2Q9kjLEDIR9eCZf+w4xuKgMEKa4dWhm4\nHGJYnipyWGanH2cXC2sBE8KA068MQW4YiD5gmdeLcERfnhr6Z/9ejNTnm0b9\nuCHq8XFkGM2NSV458wzKzSuOg5wQgIqnMpT0sv6zWB972FmOpGWTjR03Q7M4\nHmQr1dGql4SZd9K8uJ7dWkNXcc0nkMINgwEN3n77RIupkWIe+jsMAB2X924L\naOPrf8mIzs98SXc3aGuU/4jTeLSiUgRAEVIfDBq/SomU5jiB1zSieMOF39eD\nT6hfSzOJON0IKWGWYGe7tsBCnqnuT8rcYVew4AiJSJaqjSipF1u+O++/LtHb\nUuBDwjEWi0TdKvn+mz+/7VPHhCwGa+QZNlV752ksoVygKNtWLr5qw9j8ZSVm\nkJFPoT0RiVJxpiRFjlXKkL6ZVU0pNwDHw2RmeKeUUtoguXbpvFsKUoF5K4XK\nPwCLgZzXjG3sTuJetR/ZBMNVOE4exhUDccmucXhT0anKhLdE/QjnauJJkwCO\nC+SopgbsvkiCVjIIJY9RHGeQzbDLGvswXtq1TjurLM8G/DxScthhLs5cFHja\nV0yKbee3DOlki73Q+4eQpy1+Y6QtHlQYx/iwTvDjohE3YDeFlMEo/h16tEQD\nzHm9\r\n=tB9E\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"a34ed29e556de2894ee13507c92540ca6a55f035","scripts":{"lint":"eslint --cache --fix src/**/*.js test/**/*.js","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","prepush":"npm run lint && npm run minify && npm link && npm link @skalenetwork/filestorage.js && npm test","coverage":"codecov","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh","generate-win":"IF NOT EXIST .\\test\\test.txt fsutil file createnew .\\test\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.0.0-beta.37","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^14.1.0","chai":"^4.2.0","mocha":"^6.1.4","dotenv":"^7.0.0","eslint":"^6.4.0","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.35.3","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","chromedriver":"77.0.0","randomstring":"^1.1.5","eslint-loader":"^2.1.2","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.5","eslint-plugin-jsdoc":"^4.8.3"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.8_1573139493541_0.4660734030930582","host":"s3://npm-registry-packages"}},"0.2.9":{"name":"@skalenetwork/filestorage.js","version":"0.2.9","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.9","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"44165594b51a24d96e2f2301f91e2b5b2a4a8e09","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.9.tgz","fileCount":35,"integrity":"sha512-rPDZRP+QObyhgxWa4OkjRbVqibkPY3DGNVIQzNtQgVX5Hi3al/0hy2YYPWfc6piniKgKwKa9YQ2gaSMpnCP7IA==","signatures":[{"sig":"MEUCIAde/WHlQdPl/PymbjzEYjMvfy6ogHi9cpGHg+4jZiWSAiEA1NngIP5YuLuj4fgSQkxlBvImVAnRhua1axprEFO2/bE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9898105,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRnlSCRA9TVsSAnZWagAAxCwP/RxwVgT8yXu3eMzytaft\n8J65W8xyLKj/xXfZ78gayvcKY4M7bO3/FSj0hJfOSqg0HU20SEzKhTyGSWho\nlAJosMMhBx8pCKt1gOuMP9+/i+xnTQj0b7HHtJgoOsUETsR1EcneQVSiq1ey\n1D5o0niNoAhX0B6Wd30o3gENtSMPwSn5aJ/f615kU0V316FVm3cMTNRqST/o\nTgeHPCJbhSD8VvOYnUk7elwIyCuEdrofJcl5XEuJxpdFWPc3CTrOJykdskl7\nEqQQAlLhtNNDOrT1XHqKyd1TigUvJqn1Ay0ANUeo2uQUXugDXZSk3H/pZAle\n9AiFqVkGPEdHPPNmOM4gZqsr2yZeOBp04zNYK4gFMNnJ5A1iWHpIIV6eVeD9\n0EhDuJMCXg8RiKHUTXnCWkyxIzJP1aBMA6u+40wVHxAkAmeXF2ac0fSlVZM2\n6m+Zzxd4csihE04un1b8BtcHijT6uMurgYfLH861bgvMB3qfrZMIC85a+q03\ntU0IOvHbEoABOsk8qvzrbMg0WNlo/h+v4Gc7HkA76f7WPPoxLxnBMMdGbxPA\nHW+GDdOlT+eeHWfMjzZxbUby2IL+13zeFmmJPmGqYYr51A8asnrRsFrYLbrq\nO9DtHZZXPbUoGEdfiwziFDwyjCvC/xvjW0RmtTF/kobLIaUg3opGIa9CudUb\nTQdw\r\n=oL9/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"09783fe710f9fd728ee6249c005e3a803967a7ca","scripts":{"lint":"eslint --cache --fix src/**/*.js test/**/*.js","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","prepush":"npm run lint && npm run minify && npm link && npm link @skalenetwork/filestorage.js && npm test","coverage":"codecov","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh","generate-win":"IF NOT EXIST .\\test\\test.txt fsutil file createnew .\\test\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.2.4","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"14.1.1","chai":"^4.2.0","mocha":"^6.1.4","dotenv":"^7.0.0","eslint":"^6.4.0","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.35.3","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^2.1.2","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.5","eslint-plugin-jsdoc":"^4.8.3"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.9_1581676880313_0.9898630036580054","host":"s3://npm-registry-packages"}},"0.2.9-dev.1":{"name":"@skalenetwork/filestorage.js","version":"0.2.9-dev.1","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.9-dev.1","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"c17e6adc56bbfa26566a440ac7e6700f29540e8d","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.9-dev.1.tgz","fileCount":35,"integrity":"sha512-GYXjiuEXZX6GLYHTLMVfSxkuUA6usMAu/F3p49fVxkCUlT412cp4zngA+JACufTI5GP4hlvAgJF6r1gu5cH0TA==","signatures":[{"sig":"MEUCIQDxW9Czy9GjvOaaHUy6/lKL3K5vrrFXPGi68KAG4ScggAIgd/C6iQD6n7cfRCOhm5Byfu3tE9l6E2DR0m1DtDiXATM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9924981,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRqftCRA9TVsSAnZWagAAkGkP/ReyzWlfoKoXRhIahrZD\nSyelydDtI/EKwvjZBIx47xzxP4qlZyO4dYHywfTZHfVldLQqRDVdi6fh/oe+\nnqdrIS+NmKp///8h9IwVZf+nA+1xZL02WxO88+eSww4a9oU5KDk2FJzSDlUR\nRpitJ9tnXZorV36cAtOwpNDi6l9h+L3YIVhqqWHfMHf845zUIkGIRUS2TYMs\n/h6GoBjDgYZ2ZFsQkCBXSp33spzBkNbUHQhkA/vviNHgVgrfFGpf5WaG06G5\nsIuS06JDd6IBvswyOX/KjBeGuHFCNhh7TreZwQBlfz/im32wOllMn7OdASJ+\n6BJYDNOSGmNmEIs/Kny8jeGSme+RjxFtXUFbJYsjis9IoFz1vpu2jJ02KLuS\npJhY4jUHroTImh+66esTtktdqnhKXA03EsYqLD9iPuvvpTmnTJkSJrvslQfm\n/qfFhDvcscIkZkRO7zHNB3UsWIFY05sE5CXyvcIArkID3oD6YWtCMuCuFtIS\nOcbQReswny3GsW6LQri4khZfy5HHAQTr+i2jx5SEGS9nftEGBhFnwlxjy+CE\nL+nUsJ5l0NvgDYnitOB5jZ4ybfr8T8iHvk4Plq7a3V2nt8LA0emK4/75kK8D\nGSiAOEW+Q0FDFSmkOXRk2MtZDRaXIiV9AI0yS9+5EpNGxSW7eqmSby3XUG9Z\n5Srr\r\n=gp8S\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"b865e15ecd36d76394b0faf165d8c2afafbf8f1b","scripts":{"lint":"eslint --cache --fix src/**/*.js test/**/*.js","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","prepush":"npm run lint && npm run minify && npm link && npm link @skalenetwork/filestorage.js && npm test","coverage":"codecov","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh","generate-win":"IF NOT EXIST .\\test\\test.txt fsutil file createnew .\\test\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.2.4","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"14.1.1","chai":"^4.2.0","mocha":"^6.1.4","dotenv":"^7.0.0","eslint":"^6.4.0","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.35.3","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^2.1.2","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.5","eslint-plugin-jsdoc":"^4.8.3"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.9-dev.1_1581688813074_0.13744677290281637","host":"s3://npm-registry-packages"}},"0.2.10":{"name":"@skalenetwork/filestorage.js","version":"0.2.10","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0","_id":"@skalenetwork/filestorage.js@0.2.10","maintainers":[{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"eafb1e0c7a87752673d86a08ebcdb1d073d2a66d","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.10.tgz","fileCount":35,"integrity":"sha512-PAIzyk6fEpM0yD/QQUrC+pzEc7b/4JSxH2ISWY4ME7F/J822jzFNegeF63j9ydugaNGhCL8T+GLFMJ4y8Ha2Hw==","signatures":[{"sig":"MEQCIEfLDXm+6E9mMP+1T7HvgHBotPELvplGojgqsn1RhzxTAiAEhlaAn1z7VABNKQy9KMzcpljVUxJP6M+1ZqO0JfPWxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9924976,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRtpoCRA9TVsSAnZWagAAMmkP/RSBbinOG9k+vQg1c7D0\n3zn4K92+X9reyzvu02rE2lTvozZgVIsn3PrFiyBIdEXamTJf1xBbmkhEzGsb\n5xC50E2t/r+XWc2bu4FIbrtF7WguQ/Q4F9IrVgXBBw5Is49u03vK3ZmGyrlR\n2yTknUhIRjh13TxMXU4Ya4Ezqz10NxiWzLqq0aBp4UapplRgAK3pgjmBNGE7\nnl+irhl3fs6VPcAypfB4bDlroKmAZWuC1gIuC6fbE3Dui32f46RbNAAcXqcT\neL3CpH/fxD48xzIhy/XXbRyTeIvzhdPBhXFSiQJnItop4muTS4FOvSVOuSU1\nn+em0WW56dzR4st3ktBkwch8WepbuzZoJEcbNwHr0eIH2aGYwVLKruKouU5v\nZ7tYszcQJo4aF8PCEAVwvWukCX68pLzbyji/dxOVJR/SsnauGeYBpytJApCc\nyDD3rMU7myi/TZ2EUhEp3YB4X3wk6yPbxilB9BqdwOTphMVGnq2ubc1sCinV\nqfNNp+uWVgtd19au3oZ1GPx/qa0xJbVYoXSM58KY7xXRJPDjp0vCjXHeMtMN\nDz7ZOtXwvgEzO+n9WArE2ZGWdEuRseRnVbxZgmiMf+D8oE/BJFzMRqxRcLNa\nONVhB21JJinpRoBKSTD2IlTwYZ6kimIJ5ttBVPkUUgf+X4hfNiscxEWneXVR\nThvV\r\n=LKQ/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"0b90726eb7eaf847baa38d433033294caeaffb24","scripts":{"lint":"eslint --cache --fix src/**/*.js test/**/*.js","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","prepush":"npm run lint && npm run minify && npm link && npm link @skalenetwork/filestorage.js && npm test","coverage":"codecov","generate":"if [ ! -f test/test.txt ]; then dd if=/dev/urandom of=./test/test.txt bs=1048576 count=100; fi","build-major":"VER=major ./build.sh","build-minor":"VER=minor ./build.sh","build-patch":"VER=patch ./build.sh","generate-win":"IF NOT EXIST .\\test\\test.txt fsutil file createnew .\\test\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.1.0","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"10.4.1","dependencies":{"web3":"1.2.4","streamsaver":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"14.1.1","chai":"^4.2.0","mocha":"^6.1.4","dotenv":"^7.0.0","eslint":"^6.4.0","semver":"^5.6.0","codecov":"^3.3.0","webpack":"4.35.3","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^7.1.4","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^2.1.2","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.5","eslint-plugin-jsdoc":"^4.8.3"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.10_1581701735477_0.6676368536767934","host":"s3://npm-registry-packages"}},"0.2.11-develop.0":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-develop.0","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-develop.0","maintainers":[{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"d9e186f5acbe8592a6373dbc1577af697a8cd1b7","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-develop.0.tgz","fileCount":43,"integrity":"sha512-4wTtMSt3mskZzD5OiCjVv4lRFm6cxNbDBYxa1zGaJ1qsewFxMIXj73E5a/w328AIh+rC6mJV5oEMKdMLBymNRQ==","signatures":[{"sig":"MEUCIQCkFxAt3H2oHa8d+ia5LxQeWqinnLtlibicirBNdwnlggIgQy0FGvvDZmNnSEx/bO+u3rNMpPbQLbnvD/4wKUGY9OA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10038382,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfc05nCRA9TVsSAnZWagAAdbcP/iGmyWf704goJTuIUqTO\nKNE38OnOVI8Q8YqbEGnxopfcgFZNLrP7zTwxaeYlsleqLN6iF4s03htgqEaS\ncz+T33nujvkk1Ms1W3Rh+jot1tPbgN9fafyOZSirFYO+soi9MDkek8+Ecogg\n01gEYcMA3m5fvG6dsB4pyKV1CYTPexmH3eoF6GNqod2fMuAgNHN2xBDxxHsC\nE+OsuQctS8VmE34i02FQ3kiIetP+gEHpQ+1TXkfdX+H47w+9Asx7kIcS4Vft\npAINg0XRc6HptnBttYDEo7NQNGXMcPdDm+fpuQZwMjWmfzQbva9S1dvEtTTw\nno3HPIn85y5d89dqa4oiUjyJ9gLjhqHlTgUB/xYMlLDezgi8tZkx99hv2Nn7\n9EujhOkk/Hp3eZdI+8FQg5Y9rCahQ3sXjkPHSa7ifP82PJjfVbXlo4WwN/eg\nzw87pRaBO0Dh/oaLUd0X3QxA+K6hm4ugggoVx4w++vtYqgal8bR4tCqUzgWU\nLE892Ozkn/X1CgRZoY5/zKj6sgXmaexp3qwQXNgb+I9dLOQfyBIMIoqjfZXF\nOcgX7NaYTKr+GwwpLXZhzlt3+n7oY//LgQ5JS5Z6zyTk4YqbIIp9o4IrxbQD\nDGfcd8//oQSmxDjBwg1es8aSuH+acE5ZIRHnkaDbjNfOUkkbO1UgHjSyJmNQ\nTx/j\r\n=Ex7+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n**Note:** Build scripts also do version updating in `package.json`\n\n```bash\n# build patch version\nnpm run build-patch\n\n# build minor version\nnpm run build-minor\n\n# build major version\nnpm run build-major\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is {major}.{minor}.{patch} For more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"de58aa90a9e85d864e7bb5f2222955afdd5e913e","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","prepush":"npm run lint && npm run minify && npm link && npm link @skalenetwork/filestorage.js && npm test","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","build-major":"VER=major scripts/build.sh","build-minor":"VER=minor scripts/build.sh","build-patch":"VER=patch scripts/build.sh","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.6","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.18.4","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-develop.0_1601392230627_0.643345281919963","host":"s3://npm-registry-packages"}},"0.2.11-develop.1":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-develop.1","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-develop.1","maintainers":[{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"b92065686a61e967b5ef91685241f57ea5e91853","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-develop.1.tgz","fileCount":42,"integrity":"sha512-/+FH0JhksQONAwcohNPvFIFeET0xwjGefmmX8nhv0S9xM+8z+ts2+maR6edNyLE6myPmV3Eb9zGtgfgenyaRCw==","signatures":[{"sig":"MEUCIQCPedm8o0HN/VEQM8NJpBlrb4EvGFCeLqfpRSO61obXpwIgQiZKlixiKcKLYFx9CfmeLcurGDIdobqYE3s/C2thfvY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10031153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfdwPlCRA9TVsSAnZWagAAQn0P/1mEwnIv7p97BwM8nstv\n02UpDVdi8/I9pbgHCxPSUogLHxutX2QPWf86ebGjAwNL56v8zVJKwYYcMX0z\nBk5t6WWhaIW/rTdrGil7up/Uj+jeWv+uToDWC8rgEel/z8pe5kYsPWd85++S\nkiJiUpMaN6ENSHPuwuqgz8cObLBOMj7P3qgyLkyJm6t+Oi6jTensWqZTgf4k\nCK1FpsF7G80KnR4cPgWbkH7d3ZdpowNzQTg54h3WuFcIFy90ZSxYUtX8rqa7\nkYZK9gYhTpUJ4I8qBuUEhglZQhD3heRfiu6cNmctbMTGT6DlyMKKAbN+POES\nxVohteU5XsJGhBV+c1+uwq8B5ksSHj5pPiUHMKqRzxCKJHOZYOXUz//AmYQA\nNvGvJEKGgo+oaUhdUNDxplsp2ANEvYUULipr95nn+fwhtmh9jwzi1eSDcMpC\nGL7n4ENISRokz80cVAQ1HCkzS4IrsjVNiUnugmF+l4unBY2wlZKaF6nKIjnn\n2Bk2jWPS7CZLV8Kfi82fA08nXwnHEKR27uvXUnLhUKA7wFzgztVkIivDjwv4\nxls4IkCp09BzMPcKZ7ku9Rd6OLuDiuId6GSiXjidyMqCC0aFoTMabUvlXqcl\nkGCO2Bcu0rFO8mjX9cGpXptOMoU5RGDl8nKmBBBlR6lnEWuKtAz+BlV2h3p4\nSJa0\r\n=kbbQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"e4a7b2d529a8d1cddd4a1261e058fea22ca81073","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.6","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.18.4","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-develop.1_1601635300276_0.047279070538584156","host":"s3://npm-registry-packages"}},"0.2.11-develop.2":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-develop.2","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-develop.2","maintainers":[{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"cce5b4c19f275cf8532655b18c0462ea5bbc1f93","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-develop.2.tgz","fileCount":42,"integrity":"sha512-dPqlA1d8wtERmu0pG/OFHRZq/5jJTB8eGKKTL5BtrJv6Mm/B++GPWsiBG+T/7s+8OyEoJRLBZz/eBxBQZOe48A==","signatures":[{"sig":"MEUCIQCbYHeDPToKs0/YJEqfi4MAFNIMeVUMDyrU43TR1AfmLQIgMe4uLUzf0ccmbofdUd7s4OfJh/AIJ+hHVryqXJUQMuc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10031204,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqmFkCRA9TVsSAnZWagAA//wQAJ/OMi1iYaIMjzl5vp4H\nB+H134tdoG5Acql3H92AlmPSQGgG0bonu2Tmbbp6imsacTAvNIJX1cwaQwOc\nSYCkfwXHSkBqnrni+NzXENqBKAmVHuTS+h1eQuHCnOA+5hKKQKQEWhYUWxSE\nz2n5mGFCi+gBlyWBksmf1dqXiienu4f/XL1NeXQd7Yz8MZT8cgULF5Q1thB5\njWQt5YmOtEe4eZdiqlmzsuxC86EAlpVM0/NGO/Sg0C2PlGsHU8XgqiFQuQuu\nYK0uVEz4eeX7XlYD/c0m7nqGGj5H97tXREKajSd3n0gf5Cg3i9h5R3UvIJgV\nLH2Pr6jgtp6xWszEsyAoM7JFEOWm3nXW4LDd2k7tuVombbvAN1peRGh2zxPd\nBQPKue9E32dgFaiR/d2/QhuQoItRDnAnT3Y4Ue8/sYUAsiLoG6aevAbnaqLM\nIQlCED9y4bKv+h+8+KUIGeNBkt1INTHzZe6a9JfSIQBUcHsydROh3pI7WvYI\nl00U0hCGF+9rl0qQQBTEtrG++RrGZjFYE6qieGufK2xYFVF3eCcNtxZq8Nqz\n1+QY3Qai75QMkwQmptK0yvh/NXlGjeWWKqVjmUYURCtZqATZurzsRIL9W1WL\nKY9SG4a3rDt36hjzwUM+WYEMUmLaJ+IGXMDLFGvqxlLW09glRsfvCx3pGD5K\nCHQQ\r\n=hXVx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"df259da2004c6b5668efac4cd6679139d0a493b4","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.8","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.19.0","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-develop.2_1605001572138_0.6255626085299613","host":"s3://npm-registry-packages"}},"0.2.11-develop.3":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-develop.3","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-develop.3","maintainers":[{"name":"l_sergiy","email":"sergiy@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"36cda64bef5cf14af060574516ff37687693ef54","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-develop.3.tgz","fileCount":42,"integrity":"sha512-S+qYgTYmVcRNgg4zEESVyyGXX5FIMBl9B1iL8EK0OPAIWtoLe+5DnKeAJJyftcRHgcV9gSCYLjdQR0spofzGsw==","signatures":[{"sig":"MEUCIQChM47YdOVB5FcEMXaJRpp5Ka2+nUvnd/pHQ1BfBWeDVwIgIwHQNsLJ8OfhNEUUxDC7OHbaFuVJOZUy9wIqa+etX+4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10035154,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgm80fCRA9TVsSAnZWagAAFnQP/1mx6Y0yci5F1zu10rrZ\nWdm7nYjHtQ7kgI+rNcP3r1PqGH6m5OVb/z6dMTkj9G11Wp/mB96reiBR575E\nfkUo9ft1aB3HYIbz87Qhageosl1Tqc5lsBGUrax4qGiA4x9yjDDVafZlBR01\nzFwunwrKoJi6/BjBzdXux/AxvZnu1kKGQVtJszNX2FdWyq4Qa/dXZn0On907\nX6JuajY+HAfGCS0lleK29SmX/1E6wPFzxiV+k30xWgneK6gzzqsdcYX2MJkr\nuHG84Qf/eaqEUmkHMnVbBZRpFrhvQxZw2iAuB1fUjclnw1VGMRgUwbwBah+9\nE4D6Tdja2XFh68VowHfnSnHERY/Nw3MRkZinhoYmSNi2O0fLfbaCn7WTxU65\ns5VDcs3AFqk2lwNSY2L4M69L7x6MAVLNOk4u7gdzTAu/e6/qEAP0MjziCXbQ\nvxDe+bxouHxP+X4cDXgkKaoFHX93WzYr69ZWnZj8pASLOQglnZxqxdkwGisR\nkYBO3gJAIeTHIQbzgh9ViXVG8MAozipdP/IBK/jNOGJswud1J9PSEezFrBUX\ntI6cIMzWoJ4F0a0OWvF/X6odyqD+dEVWAKoOb54KVHegWqjbq3RmYHbSQALZ\n9Gy/9i1si667OY3o9TiLIcV0I+ez0n5idpnk1jASD4ipluShC8BNI2eGsvPb\n01Fo\r\n=wjxs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"2f887c45efb09ce64ee1220fd552f1e81624ff84","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.12","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.1","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-develop.3_1620823319898_0.2025750831012001","host":"s3://npm-registry-packages"}},"0.2.11-develop.4":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-develop.4","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-develop.4","maintainers":[{"name":"l_sergiy","email":"sergiy@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"c5c098d42b83bc97a870ff1be971b490439e2fb2","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-develop.4.tgz","fileCount":45,"integrity":"sha512-qkZG0bQhDU2hb8Jf9pfbveTczhWcOePSLCvI/Q/nXTUYyhsZg6hO/bPoTy+m+Ibda1o2BoJ0GC8erPQ7JpaNXg==","signatures":[{"sig":"MEUCIEKJO5yb5ZKLaZt3beaYle9cn6GhjHkw9wkCJPHFyzFZAiEA3FSRYWcAyoUMfcHd3bdxuijpoapCbke43KhHvlyAo9E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10038078,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgp5w0CRA9TVsSAnZWagAAXREQAJr/BDaHXE1fTqL1yxJu\nPHevC1k6RK4s0CHvzAK/7iTdK9VktaMpXlMDJ3os6WFzpC+EvVIk2FQrEKhd\napgp9MIVjI1Ae9HLYsoUEabeBvf/PKdRosN1fN1z/NuWqUDv1cC3m2qzI6U1\n1QSgH/f3urC3AGWvr9GniBShSqrcGSvpR5C5WmMvOEm6GHhKCKGtbt18Zw46\nz+G7db6NzFgiVHnQ9P+xoJGcT6pVj3epLjcipM5E6HAtYoM/1FBPCjtNFjvh\nTQx4WR6DDUIeucfDYebvrk6KbqVLAVE9o7ms/0wPoKoncVfnNONgiK6AYwJf\nBMiOeYnIk/ENHofelwkOu14bgy0gSWgqeqeKcvXB6itWCmiHDfI054R3hrnt\ngVzyZoFOBQQzCFbC40r9etMIBlcTGorOps3XKZN3XNHz93GwOOkmbc+6fhji\nmWeGiRdYN69p/AdupWkBmHLNcAyY0vhJZt5kWzIX0j2BKLeytrB/n+9CFavg\n9uRFYdC7x+fWv8whNky46Rf2qUWgmneUwCGIe1aZ2LjCjj63m2wFInx5+Ee3\nu+mFCjvK0wXBozWILnYm5/vziAmAHl6tMQQm6xUUYdGNy/xi/v8fd/zaA790\nPdh76zn7Tqp0C3qC8i4t5ITyCTb3oqyqIbf8nj+DGgi2kIJ21R7QPctGqb0G\nt6NY\r\n=6C+k\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"2fd9ff73d6a5cd0c0b5cd9524b9070cd229a2e20","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.12","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.1","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-develop.4_1621597234666_0.06018657043950637","host":"s3://npm-registry-packages"}},"0.2.11-develop.5":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-develop.5","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-develop.5","maintainers":[{"name":"l_sergiy","email":"sergiy@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"d61993bb398c5c284e6a3df329b75f5445751ae7","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-develop.5.tgz","fileCount":47,"integrity":"sha512-l0WlywSPSAHoY+wi7UMDsOhYja9sjdv5aAOq5RU+M31ovGxDpFCXsYBGqMbGXMpyXquI4NF5pkdBHZpKjI36dQ==","signatures":[{"sig":"MEUCIHcJB9LwnAyppNZxeK/+xv//CmukealIDlg5gnGGSWWhAiEA0Ry/hzp5+2rYsItqsSstHU+tmTiPI/IrkHL4zXaPUKU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11087791,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguOJ3CRA9TVsSAnZWagAAEzEQAJXwGQPuJmCxe9om6aSS\nTifm6i+faMacgmXfdTM3P2mWuj4yzaBNwllASnoD5mprdFq9VwU1CBHiolrp\nN+Zu07TVttLxgNLlqHS+lfVPifVGRbG6UTGsROhGEkVVF9EZGoUt5WdNmw06\nN5LYt/mvFKHJnsEpY9jS5A5ONn/BnLMGC5U7q2J8bpuBT3UXBPaAV9NR898P\nwRfOIqTTLVgifoaIi4JCNc7SnpoaWFt+V/95i4Eo4aCoCtGd9vHWRjr+SuqH\nI3sJLuTIRx+rWwQdGE9BwU31DQ/Ter7KEot7ApZa+B6p8OX2hkaielby1Kir\n8YSnowh5xIvlRfU0xAam7tIQcnhBYkbALfR1QRGk78MTsadFZpYjjz3kmklI\n/a/fv4jpUppF3uqTglmSsON+2yp4BYLyXNNkRLUGJFz6Xdy62uJA5qpQbOh5\nxHzd4TyRn9KoLI1IEe6fqIHeXdDf8yNeQ7ke5YtX/MX0pcPF2GASaJHTBCdt\nhcGCdwGzcaJXW4ak2Fv3eRWWECtI9VOJmnNSk6Xq3uqOLPnFgzE3M7GCATVW\nqLZEwlW+7Zm7XMsKDuH5lak8TXKpFaIZ6tQNUQX+zBdmwUszY3fTKJLeGvnj\nG4b/9QuXRc2EBNqpIALahGlQQKffPH4IxQ3S3ztCXjZTM3NyVAcUmayZxdgo\n6UcW\r\n=YDtI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"5dc7f207d76ff7c0651088c575634fb01eaa4f8e","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.12","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.1","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-develop.5_1622729334050_0.4591929301384776","host":"s3://npm-registry-packages"}},"0.2.11-develop.6":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-develop.6","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-develop.6","maintainers":[{"name":"l_sergiy","email":"sergiy@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"1b39cad9c60462fab374fb564d3251dc6d876eac","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-develop.6.tgz","fileCount":47,"integrity":"sha512-NeA/44T1N1YnDhm0acp0/TonsuE34RGL2jOhFWynlk4TbpEn5hANymxq41SgChYvo/t90jIYeBuDK65m3Ow04Q==","signatures":[{"sig":"MEQCIDyL5Kg5CB9DILIUF6Ffo4m2kfDsxHnFM5u5h5Aa0VqbAiBu3BRSr63gQXr/O+W9f2pEgkT8SrPoY2luA602jAXYHQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11088039,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgv5e+CRA9TVsSAnZWagAA1RMP/0vd7gIy9BvllFatNJZj\n8GyxuKcCkOrtC42jpCsOHwLcpxfrgQi9++p/0zUZs3JgeOxraQYF8QFK+jTv\nPtXIbFpHuF2rK7ktt4auQuIc4se2js4o0FxM0HE7jfNYnUVqH/pP04Uw1qoz\nsLa4TClu+6Wp77VzMwEYBEAHB58ADALS6kG53GQwUwgDleqRxoqA8mXoxtpO\nxHyP5FzevT1pnZ4SKtv3JeRN65fN0j6OysTgqowcndKYbaZILN9y7fulkZLz\n7CiIdUwSNb3XTG6mA1IhqAiQjgCd0oFwCMO77eeuqGMLP8zyVfcj3nozWE9i\n2+c4+6OKT1FTTtomR9JiHZDkkIOeQs+wlaiVBkBschebe69XjQ0fNduIkqS2\n6H/4y+6EOgpoGK0T6VdhR69EMSbOkL8l4MfJu33qb8phkwZilrmcdDkje5AR\nLOWPfFFsb+dYLDp4cXqbPIEyY1COpYXzXLbuP/FSEWtW+GvczxDjCKjOeKOj\netQ6zNxBAhHJJeh706Jce+bhhtNl/tweHNyULro/2FSiDY1QA5/HgSO/Oreo\nmzSz2UZLXjbZOk4smmFuGF5AMuAk9BJyeF6W2Zj7s5kDF/h+ayyhbgZe6AG4\nDHreAP59167Inbr2Mkw48MX9jx7CfGVjLRwj6h0jowTx4BmnPkbHYpI+QRIH\nDgmX\r\n=cvHh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"36f37a7ab75264f76e65135cf722d0508cdc21e3","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.12","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.1","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-develop.6_1623168958069_0.6441228118558566","host":"s3://npm-registry-packages"}},"0.2.11-beta.0":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-beta.0","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-beta.0","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"134fc1654087ef79ea9b969aa6baea39ba2d899e","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-beta.0.tgz","fileCount":47,"integrity":"sha512-qWiYzcMNJucWtL2+YRxzQ8tBkh3heyiFFPGpRoemTeUsqjkIt/CtwVClsB+cOAPc4KTQyo4O4mYmMtkKCg99XQ==","signatures":[{"sig":"MEQCIE+pE90Ze+N9TSQsKcx6TIVnkHXZuV6TpC8pS8/kpHrpAiBmWiaACNG9dV033j4dnBLQEQpp1/0o5dAAAqY9CNk/pg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11087788,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9+ftCRA9TVsSAnZWagAA8/8P/0P06cIb8u7nC59YIGNE\nxH5sI8nahXqXgh2+qRpD3P7XpzacmZZVUqpgwNbNE5QyatDYJco6vYDhI1dN\n8iw8vqeoyc64XEvD9CbaOb30y7gRIqZw5cgfc5qWvxsgbK8gcKikSm6kj6JV\nrAWwpsd7BxHLQWePeBD0Lgc9yXbfR4k5vI0vl0ysxSoI+alo8dLp5H/CJ/oo\nVzZEkpYkRtCunZBc9rbdQMQmFVVhMLwXegcOooNlGZdgfhYKdiSn33Fa9CPI\nLA6Bi5IHFGExJLBvItcEJxfImkmp1ICXta2RhTWFEEkOv6Y4Lc/jLbjxNcO8\nwXJYexJ/aN7l5fCATsiwAlRkqcVfU71vgnq0WJ2Ua0+Pd9rnH7G4OEbugz/c\nnrCwC9Sw/sTfZeA80lCXAZXAZkN9d55/3y5AIkTzPHJbFhgyziU4jljOtU1h\nvqM6CPWOZX+uwkR3/1LL1ivqMJC5TkIt1uCFFx9UvmX0AAOjmB0lx43hUvF/\nkB0ExAISRYiXUpXbZqjgdNHplTXIyms1fwjcESg+B0hJgurEPQzmA+WjloFt\nuAMk3yPKiJSKbf/HxbVzHGmI+Q4+w+mgK3ns7mURElRRLj3b9nthzEeu4p9d\nCtCnM7vjCENACBbkWny66BLRnnBnpqlWZIeR/ztQupeoXnMoprLNyS2iNCkt\npwaD\r\n=+n6l\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"28ef1c3c011aba4d9569922aa6bc0ba1468528d4","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.13","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.3","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-beta.0_1626859501068_0.7437642511579705","host":"s3://npm-registry-packages"}},"0.2.11-develop.7":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-develop.7","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-develop.7","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"a1d8ed429453383614f4db115431f186ac0f4333","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-develop.7.tgz","fileCount":47,"integrity":"sha512-H+e/K5RcX0tmQ1BzgCdQq7gI7ak6qqvrb+LXEkBj2x4d+P3pyGcLl5nb/bZchnSdo+srOtgafbaSgLgOh/U+hQ==","signatures":[{"sig":"MEQCIA4sVJuM6nQo0F7y8mYOpLW8zmK7FhRfmishlZ8LL4kPAiAccmTBx0u7ixzBEmm2Mn+a37z935UVs2Sl+UIjEZbQ0A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11088039,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9+gBCRA9TVsSAnZWagAAlrAQAIpL9Ec0xa0vf5g3oa+e\nP1O4d0kIk2VOkm6z4Rf1qwiL8LferLDKIAwuzaEDyq69fVB+T3obz0edWnFe\n8nnexbBrVZEUHtqt174fuHeZUT5mm6EQ0wGFYLOT0atxgmyJrscl9k4bQvPU\n6DJ1irUr8sowgBmjXVHehBjdisriv9quBuf7kM8VxgETPFOXJxDyajgntWMT\nfyRAMDbh7L7JMhvYPjjXFqYxawi0KBwIrwkSeGdtM3DWMzjguGFHqsrgvrMd\n4BpK3x44s2XeSLfqbRCbl8YKSYaDlwXEQB3ABePuoW/3zEFE7wX2YntMF7mz\n8KrMoM32O1DBuivQOE555Lsm7P6j1RSjKGlueILYJ4Vl5PrxNw1fxIyZQDeS\nyUYghwJmb2Ze3pJ8fNloVV2cTr5xDgFc8ILm67i1jTZCNu2n6hHyyHtqWqQt\n0ERgjspWdYk0njFB83+TWEPiN0wIgFczmBS7WqlVhBMLJSy0p0km/6nNTvl2\n74I/oO7CDsx/NSNqZjiEvWucTUNHDa9QwqWYq7dOR4NwRqVZZ9OkcHcCOUpF\nEhpneVuRaOs2WZSj2utz0qYZtm2NcjlvQiGtx7kfjBSme+ItCi1trx4mLfr6\nrc4Qwfno7JmS60ZJufTu8AcGDfOtPZ9uSzbS7eQqDV5zgnkRyjR8ni/ij9TJ\nokGm\r\n=JzzN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"7a209d110f8e697e2d411174a42db4b45975ad5a","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.13","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.3","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-develop.7_1626859520977_0.05371917219256073","host":"s3://npm-registry-packages"}},"0.2.11-beta.1":{"name":"@skalenetwork/filestorage.js","version":"0.2.11-beta.1","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11-beta.1","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"244a17a84a817df616854a1bd8a34e0768f984a2","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11-beta.1.tgz","fileCount":47,"integrity":"sha512-OsTHhC0ZJLOIb0LF7ARkMBG/71sLL35PG3OZg2OaStPw8uP+drFc+v0CncrZoTjcmCHOEV40R2BYkW50N7jvDA==","signatures":[{"sig":"MEYCIQCiBuQ6WfIagCSutGY7bPiHfZOtmMRjCJCSPi1zhpva2wIhAMuDR6vks6DMP5tE2ufbISHeFrf+OGqm/mFellJCZ+m8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11088036,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9+qWCRA9TVsSAnZWagAA3mAP/jHWN3ln7tBMDIdarqEt\noro0V0FcCeYy04ll55P7HuagXilBjObC1VFnWFoE/JeiAQZki9RdkQQGpgeS\n9AwGEYtan8w6bCyE+owHTE2MDB/+a53kstmxH28sGxE96FMZB8US9HYdx85V\n0S63d9HZRT5YwhmQ+JcwyNOOxwvo/SmF9RuGlcv/iykFeklgxBscanDEA388\n7wz3KOapTzbtqaYv5xklNMXBkIuxeeDoEM1BrWDmry3jOw28mlgBkECPzTel\nPrlUVzF0TOVf6niI/PacQLOXi0H/VHiZmc5Zeg11LpBWGSYpCB2b939DVpEm\nqIFYmmSuazPuo/VdqtrD+oD9mZVYVOy88eTLPjEixWZW1SKFMhOMLnmKbu8B\nf2lTv1qC7ackHHCpGd60mvLuuJWcpfgy2QAT4JmZOFl0gPyj8oLsUiBk2sti\nAWeN40gMduQjmvgvQn91OBIdH0Nf2ua0X7jh/w5fSPi0kHsnY1Id2Feueni1\nKpC+JskXU3wUKGgsNE0Dgat44bet5Ltje4kttxVG2M2lDdzBsRituUr5eD/V\n/IiAkkkEmikIiPfktMAAlZ2nPNyQzUf8MJSyYqgiDowIEINXlg1ySevHDFbF\n/w14YzIQ5/bPp1KugvxE6uqR4zM5hFbx/cxong1VOxNLERsBb53SYe3lGNmq\ngjJF\r\n=3GLK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"0dda59fdf2f1ae66abe388d23073e37de8945245","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.13","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.3","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11-beta.1_1626860181704_0.42932603828018867","host":"s3://npm-registry-packages"}},"0.2.11":{"name":"@skalenetwork/filestorage.js","version":"0.2.11","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@0.2.11","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"e068abebfd73aa8186ea6928f74534044fde4ef2","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-0.2.11.tgz","fileCount":47,"integrity":"sha512-nV1dgfqJwhvcAOzuq3RXSDVb8kM+UUSRLMdn6ha5S4SF1r4ENE/t3EJhkCY1t6HjPNmSiGdGXWMxFgohgrMFVg==","signatures":[{"sig":"MEQCIFRBWSxqNeZ5jyvkucXNgv+q+WKb3vkmauP7JF8O7guNAiAwkWr6OCh/5w6qorOnbuSQymexq7Oci8iHGFOZC5JIcQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11087781,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9+u2CRA9TVsSAnZWagAASFUP/0xNgkn7Y9Jfi39h4tbz\n8LKeqCuYY+pze3RkvMQp7xZs4msNwCrLvUgwSdsS0lpiUR0YEjjLde0Bg8CM\n8PYBxuxIaDCUMtz2TFwJzU7nSRWXSyYRjLKeM94ZHD8At1k7BntFje+rC2i/\nas56MOVcvQZZOSegbOkjno81B1Sm/N1J5og0lUBLoI3tLFoX7CUHsfKtUEgP\nbyNHHGB/3VA6yrXUdwFRwix+M1NJjPyk2ioCq/Frn9kpRb5ZFOcawrpxZx/D\nRTSYCZoZ/zl0zhB2BQuBdqse80/XJt9d7ly24HWD0dUj2pYa8zzwJk9gjFwD\nU1ZHJmmVwzSi2We2TcZGOGKsg9hZ3MoAJgctFX8qcomiKpPEOzr7o1iS3aPk\na9SK3e6YjSPGeNkTZv4HlZa7hm5RN5aMa2GIFHYGdyYbfQNydSdL46qun6Pr\n8lR9YPjPs8cUVlPLr2W0TL+D4q7qyL3ia+IxO7CgSKe7+N5Qcz/qZKLMDTBy\nwQQexa2MiPxrcqskcubEITDk9AQ6UTT8g+uBlkSGoNLxLvXW8vL9ROXcLmmx\n3dgX3ET9vk/LR6MUoWiAHZZ0D1GNPKNOg5/EcFq5qH1w7el/LXoweXkBr4n/\nOYZ0WUtHRTZk5L5F7VD+gYHuDPBm3XGxX/9mbAgb6/iBFCDrbMhuzRyPAdZP\n054X\r\n=7a5u\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"28ef1c3c011aba4d9569922aa6bc0ba1468528d4","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.13","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.3","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"0.4.0-develop.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_0.2.11_1626860468303_0.9078082454806031","host":"s3://npm-registry-packages"}},"1.0.0-develop.0":{"name":"@skalenetwork/filestorage.js","version":"1.0.0-develop.0","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.0-develop.0","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"84be893d5a50b4bf53507818e144eba435a8486c","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.0-develop.0.tgz","fileCount":47,"integrity":"sha512-9ayStvvE5R0GlfiCjTejNu56R85+rd9CZ1RzIazMWZJeGR24njJEBqXm9kaNqg41D/UmNBsVir50SE0f69QtXA==","signatures":[{"sig":"MEQCIFgbZQG7DHrrBDEAvIQgSczn0ZBao+EvJ1LcRq8xqzP9AiA5Mvf3A/990eXn9P53c/3WSjNoc8xrLrZ3CeS2DkW2zg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11137960,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhLOvTCRA9TVsSAnZWagAAeaAP/RHzrRodf8yJO3fpo2b6\n2XzYOmMIIQsjQRhbH7AJS6Ke6NYlBUvZGMqjJPh4cXBG69/WosrNbLdkorKd\nJA5qoMVAVdw4NSYk9vzNTDF/Dxr2pRuJHhn3msYSAw+HS/gEyHZJLgBTTwdS\nzoYgN/Se6nnCNY6HXxgyrezBPKTCj4xyvPbIKuRzlcnlFen6voPZvKrXr4QT\nvgMO9yMyp96aD87HypTCuJgayQW89OWt1ceNKx7jbnJOaQwPCxAf3IWtA50o\nmBgKMyiSRs2Eh0OphgAXAoyhb1YxBmhANqDkPC3PO1hbagFPgLNpRCdCTXLN\nUK3k9IWclN229pQAwcu9zFUSbHR1U83ZF1xprOHKU3UNLjd8TIvs9Ndc2lfb\nD3It1hxVLibi2CVh1zAP2Y053+O5v5d49Kc7wHcvqIgNMHddtccNAT4M9jZd\nw7cP0x6KBckzJPgKq44YfsHnEoVYz1er1z9+eo+OTwtdvS6uYTRdJTT3QIze\npJ5/3SUXcQhXZKSaDoraOIF9Cbo4UyAEjm0ZAcHNnL6JLPJS7vRlf1WQzBsp\nEDoUUu89whP+Xp//85Wpn/yuDZUzVYvuxfwjmmnaPrQh5y75reg3i+gEvOPB\nHSoaQrXwSMVgJEXkjWivteCQgUGzRtwHRDYqZFIV3c75tcBe+ub6we2CvhuK\nkPqC\r\n=aUR1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v8 and v10+ support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"a6ec4170ba242e0f391ee9b5db9d6dedc028bf70","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.14","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.5","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.0-develop.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.0-develop.0_1630333907273_0.969090092789546","host":"s3://npm-registry-packages"}},"1.0.0-develop.1":{"name":"@skalenetwork/filestorage.js","version":"1.0.0-develop.1","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.0-develop.1","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"55a56694b8badab809610f26ba140b873f3d60b7","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.0-develop.1.tgz","fileCount":47,"integrity":"sha512-5shbFXdX/iPDM/lIbRvUFf6Gge6SuKsooePRvpBlArnDHMpM08ZsoZMzxa+m37/4AVORi4dCgeIx/Ax0n2LHiA==","signatures":[{"sig":"MEUCIAP1jcCDpmS8J+KkBlwKwO8ZjYswjy3ZT9Nkv8a18yakAiEA3GVAUXBoDkdvLEAk2u35hBq2VB+a+NZwZMOzdahb9+Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11137969,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhL1B1CRA9TVsSAnZWagAADPMP/2Q90rLSQMcR2OlTbzXG\nb4vDVOn+jw425syx4x4nMDLz4uOL4e4bBjygyTXHUABf+1DulBPvwrFGA2D/\nsAMM8y9Epv4qrPhh3Sn9wVf95cpB0b17jJoZdv7A0+b3unblbDy9YGjqIH8w\n1rD7ZydWSqRHOUieoOnTGlUPh2qTM6H9o7WijGxL3Y11XNYFpMjUAxD3T5sj\nCmcX7UyEP9AenWiECBuJIGzhuMVZyOqbmO0aDePckpLmZ2lKnl8xIdQk+nui\nOIXL5cWA1ckiBJo8SExAmJv2BZ+RunsqhCxbu+va0fyexpBnOuVj6RVszv5c\nmLsAuJeczXJ5e7cRTNlHttM5qFzaaJsTS0UJEjtyoEzGH1mtsCNbtRKCbhxW\n5LiSSSOphxK6+Q3EceI5WsR/t1I99+T3AgZXXO1mGzOakh++m26YwDhybO0H\n4l70BemkeMn+AyJLR1+GOKe2O8BiEg8Cjw9PUDJLdC/ufXAt+3pO+CvrvpPb\ntVSWUAB9UMBDPwicKELzqK1sYiemjDat7FWQyYgduIxhxP5s+DqdunKlYjcM\nRGkVowQ2KrqtAJmeUJ3s3ujG0HvwhCBHVhH+OmVSHSNmh3wjxd9WMXvFK8fN\nfY1RlrYyD3/L1EeppVaKfc1D3gqpDEjkYmd4OekpUxJf9WSr9FAG0xbDGUKb\nTGFi\r\n=VD1Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"9c3f6e13e4b23a7a3a3b706cce437e7a49e31b96","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.14","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.5","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.0-develop.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.0-develop.1_1630490740998_0.48218409049380995","host":"s3://npm-registry-packages"}},"1.0.0-develop.2":{"name":"@skalenetwork/filestorage.js","version":"1.0.0-develop.2","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.0-develop.2","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"22fcd1fc0551f2c41c2f0b10c2a858b08b558b72","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.0-develop.2.tgz","fileCount":47,"integrity":"sha512-kFfXRYFCEyNLNHRJGOqCOyXXFyq0LDs6wpAA7clgShlfyQ88KMsP7RKlvH7dBun+bxG13/dA66FDLbyWM3w1xw==","signatures":[{"sig":"MEYCIQC0kFGijykx75zv+LF+XmFTKUjIsOeW9oXByxTTDrlcBwIhAMZYpB8gVWCXxV/ElCRRt1dGnBXwjGxb3ilDtOPOys91","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11137969,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQMKyCRA9TVsSAnZWagAAoeQP/1BHC12ULNrjZ2oZ7RK8\nTnav4tEZU30UBtOJJDTIGTjtKbjbK6IRXM+l+vui3hrXZKaGeD+kr3yKTF5e\nmdd/D/+f/PF8nTbs8QKZ0haw16RyRG6zCabNSzPzL57E/7I9Yi/eemilKo78\nyyzyaAdcD/s2DlwGc7e/mlREgJMFDGhxznWlhAbCqHeiVY56MWV5o5qxS78o\nYGmDZVxUIUPW/bXv9NLL7tIeansBsuOciLI8i8m/BkLbz9b088ywqXC6bbaJ\n0eyQDLMG4ESloj498LYG6bpi+KWMEckjLKMi04flr4DgQ1xxqMPws5i/yFZM\nYlHPbeS5XkGhtx6H/mV2mMfFvZnZOUkkOswH2T+pMeO5bYjhiFBQh9RmPiW6\ndMmwDS5g4wM/BEO8R20dSIGBTy8ZDipVwqbXCgx6/aXIJBkJCs+GV7d7bEGD\nao/WG4hbcY2BrQ7ghTRh8NXesyi9OAftC8yNCdKLfut6G4pGuPzy5JSFWfQs\nRp1zX7M8SFfeSWBm3oC9ElttEJP+tINVqv6seaX/AWNfGnJRnLoBmIqFzWaR\n+kOGcgYTVrK4sJCNwBUVrDE51Ul5LIQN3NhForQtXYsJj/NfItZuvuW8bVdj\nIw7Oclzl2olmKEAInfEjYDCHIs6Y1aSJDaFIKbDS6nuvy4uo+rPRVF2U4XGu\nLIjA\r\n=cCLV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"79af5d80a684107e62a618f8f1950e88c153b317","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.15","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.6","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.0-develop.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.0-develop.2_1631634098133_0.5115703842792856","host":"s3://npm-registry-packages"}},"1.0.0-beta.0":{"name":"@skalenetwork/filestorage.js","version":"1.0.0-beta.0","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.0-beta.0","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"3e6b9475cd8423433f89fe9d99929e667f30f263","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.0-beta.0.tgz","fileCount":47,"integrity":"sha512-WQcRvVivzmFr/0obfpNs0ugOp3/bNN2dx/vw/iSWEwK4E/egQ1xpFCn06om4Qen8oExETWq0WX/qAZ/OS4/Q1g==","signatures":[{"sig":"MEQCIGvPij/nf0PYk4tnKluNFux+lNwKP7yk8zB60k02IG30AiAZrGo351aqoUE1/1/AxNwjQup6uJR8kU6FLz6JQagT2w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11137966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQMYKCRA9TVsSAnZWagAAl3sQAJhkp5ZCcFn61/1A0vRu\nz8sgRye53B1cPC1CbU4LZV5OFoGjth5uOkBqwpAU6tGtuRCBgZlebgbxmhaa\nTvVFuLdqx/MoeVM0gOWQ/9G/N/Je9qTp5HsP3CimRq/8S8spnjq4jX/tnT1E\nVpOk8ZjTrQpZhvtVzHb/EUeftj1HG/gV9ItJ7Jzv4PdRMgTuUvG+FQBc0Hw1\nTrHkLgb7G9PSuj3sM1F2SJLxfjp5V4Xs/UX5yKCqNztUtC+WKuX9gkTErTqA\nX67q3na8BwL1b3jMlrWAgPXzCLI3THvxEiswbbYiIaOT+KShjYFmxHh8XhZw\n5qHbwHGZjn97LN/SBIbFqlm6F04aaZs0iozT+ZjBGCqrkDuhzn692ZixZbtp\nyCzPUWKg//J5hYhm6INsqSIuXTQ2ymmw8s7NurMqcrtt6mifP7+TSEIn/VLM\nWBnEsmMyOV3NWuy19eyP22cHFsltU1yz/if/N9rsqCjaU/dTlDQPwRG+t28S\nA1YaLSuq8hSAmXwnzQ1GV4F1QPtiyEcW5qZI9ppUcLQnk1A7tdLQUZOzDU4v\nHFpK0+GBeOeljNJihzQ5CmijxXx+MHNVVSOOkprNczG1A7aE/naGz+GL93qX\nuhPsP0qtDS2QBCJB0zr5tZtJPw9scXl3PJxiaowjvuBqUGAxqmxyXsf3xj0o\nFsO+\r\n=Z5SU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"6b218376afc72b82ea91b87bdca0e90f5a8c17e0","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.15","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.6","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.0-develop.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.0-beta.0_1631634954223_0.18153465743453534","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@skalenetwork/filestorage.js","version":"1.0.0","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.0","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"49dfb508810e199d2f78ba05177a20713b967750","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.0.tgz","fileCount":47,"integrity":"sha512-ci5XyYSW1kL2dYP55QOyRU0Ef0L0pziFxYn/PEgNqpweNzEtgXOsGwhJsiTrtkcxIo4Vvgoef3n+x1uLTp3nfQ==","signatures":[{"sig":"MEYCIQCLl5iLeyTppSPYWQZQKkCEe+ovl0309p1SNs97+YVF8AIhAPaWT+wWUcbQG6YDiqzv+pUtl50DI3riR2s0iWtyWDZO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11137959,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2a05CRA9TVsSAnZWagAAwDwQAIAXxA818dmywdvcaqM2\n6/eJa7BIbZudaO88DLJkA5M1HnccaZNex+zp0m/DmXX4Le/Wo9nxr9U7kUAa\nhnxrLEMDs1aGaauJcV22NW5gtWwCjkoN1vDzdYOc1vGjoC/A9tLIUu7wK89a\nWGgXEf22geJ8bBWn6eCN5lLWmuX7QKu0CYVtgU2EA/KOZp/UvPY1aewVS/kO\nEE4USjV60qGTLH9KCsr/AGYhvk3iXm3Nje0DgsBJXuCLnhdLh8jC6PKx7E+p\nSzw46KbaQsQvDJOflWLCYBc0YPHz1vyXB65XufGqQ7zhsQe3jBzHSn31iCht\n1ZYPpSACg0JmpvBOyXyuRMONEbmVRFya/ctJDBBEDG5daAAsfVjf7bAt+0Xl\nZDapRJC2ek7VbBf2WJ0Bk8RYH4ZDMpIw02f9XIaUYoP9fAoSFag6RNbo7p9d\nE9OdUrFRsIH/eVG03QmRX9fClXmuy1NQvkgxiqxJ5Zpf5+x4o4Ss5dg9kI3W\nDYJ8AUZ9VrP5n6Y3oWCNaFgTjnYFIN09QIA25K73Puh+dfeZgRRH8Q3emeOb\n/5KZhStCDIe3a8QgGy9NZDq+Y4TR4eyCTCVpx22tOU0lLEHdQYAumzUdsZaG\nbcv9gT2qJ5A/MwncMm9so4t6eV+7bl/rQoe7gPd1yjuixk8hYbE7l2GbEd3c\nvD4i\r\n=gSMl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"2deb0200f5878bff4556c32a07b823f9af0a730d","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.15","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.6","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.0-develop.2"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.0_1631636155201_0.19424002464441759","host":"s3://npm-registry-packages"}},"1.0.1-develop.0":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-develop.0","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-develop.0","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"2e9f3845d20824ae7c6d15e3adbe86a851ecaf8b","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-develop.0.tgz","fileCount":47,"integrity":"sha512-u5X5kprPdDy6FMVsRRhOpPzWqYunMOeNfKF4i19skD2deZ6EBbH+dzn+aKDqWoDXUOWEbMBkGfo4LVIBzdBZOg==","signatures":[{"sig":"MEYCIQCy/VDGwuCJKIBKWFUv+qos8IV4rM78dECAYqXE9ErGIgIhAIukbW7Or5vQuWRVa0kLBeuWoI3Pbm+iNYlv54zKYptm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11096971,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQyN8CRA9TVsSAnZWagAAXvQQAIS6kyg34HzSpWJjRCex\n2aegwXhLyngyxpp+1ztdtOlf5mqhYnd2kNobH1XDlgUY3sSAngNWQwb8Q3sU\n8antCyFIgWZaNtA6gGh0YC1dSFE7KaOO2pSLnkL0rAEr3db4LbBj4IuBPpjc\n3sgxCeUY4uaCSDHoG9Znwr6ABY4xCTM4T4thaI+T6mQGsSxmbF6yULj/qUgE\n4WE7brjoxd3Xj6Ux+CZS1YX4X+F9MKsncyusbYfCgQt4pdCPC+zh4+yScgvV\nKG7oqq6VZBPWEn4rHbXnRncpN4dO6AgcNJiKosECa4m1FnmMDvRZw8qwsXb7\nnpttVMsx8cnz/eQjd0gG4y2uX79GhUiLGKq4UqlhkCk5eTmhQl55Xn8S/1rt\nPKWJsvowN4I5Dmwphay51+TK9tgwskm/p7XXt+6jQDeaZuJ/Q4nDcXoUX/9I\ncT/pPosrKdfJo4b4DvUIYm3aPrI7OIGm1MYcYYDWRvw8cGaJLIGQiRwZZ/bs\nIliqcFuWg2kpsd4sDfMKtUGH279pjmWSpIvYI2XSkjO7482A3uwWdBntVSRC\ngGoRYH4MQVydu/umJPwX8/cADBhBrTYPJ3AgDiSsT0hMBYL1CAHuPxX135VZ\noysbznayCcL0fAfJB5wOf/g+EbOWmoaFaiV1/Ev32dDaNVcbXzNpG8kymC7c\nnTws\r\n=4SqO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"5d260b9b5a86ce7f4a4d522969af8d582e606390","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.15","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.6","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.0-develop.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-develop.0_1631789947752_0.40563608967533016","host":"s3://npm-registry-packages"}},"1.0.1-develop.1":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-develop.1","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-develop.1","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"c003ae6a0563b512200cbe3b32d27347f9abe263","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-develop.1.tgz","fileCount":47,"integrity":"sha512-yjdmxkdZI3U6KMifGpj5JTt8UArH5ixX1wA2ylnGM0ZwCW5sTFfBQQPWvOy3syopddM1uFsCV8Nsk23nd5gvSQ==","signatures":[{"sig":"MEQCIHSeZTbvOn9DQxkeFh7bNbTATrczMBn1b4xbEs6Q5EPrAiA4xxqIWtC201yJumUjAgCc8O518GQ/8qEPcfovlthjRw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11096971},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"3aee940d0278a1652711d741ceb1b04894ffcee8","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.15","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.6","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-develop.1_1632391091548_0.7034657513186837","host":"s3://npm-registry-packages"}},"1.0.1-develop.2":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-develop.2","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-develop.2","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"9263187fffd2a578806b1e9b58bd6dbdaaa28a65","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-develop.2.tgz","fileCount":47,"integrity":"sha512-FmOkbwMn+2qL/7wl36K6jWeABvpIXvxdHyTP4Z9JrW99gJWOgTglJ20mxRZT0y5vceiThsBhHu/JR/V7QZH8MQ==","signatures":[{"sig":"MEUCIBK85I4Fj9RHUN5EAuOpjlxIXzHQQjd7I256onlqOsrOAiEA+R0637+i8FtEwjpE8kt4EvhFlvOeUhRDXgZ3n4pu8hg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11097345},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"c9812aa2c5ea76d4a3219e9a19dc32122289137b","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.15","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.6","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-develop.2_1633682305508_0.6923352626279036","host":"s3://npm-registry-packages"}},"1.0.1-develop.3":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-develop.3","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"AGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-develop.3","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"32278708de35200e9cd3a6c205b623fb085a7003","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-develop.3.tgz","fileCount":47,"integrity":"sha512-VK8nDnxQhplAuwR39jwVB44mkIGB6i+LduiVND6XEWa2uhJJrEY93qEY9ikDTdT/nyWXVI2qKg1W40a8KmESIg==","signatures":[{"sig":"MEQCIEM6deaghrDUbWrR+NVSq+FANMq37LA/5812bx56jNX3AiA665YaiudAgPBa9l1T/Gz+zeWpKONhGY48AgLj9+DiEg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11097388},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Affero General Public License v3](https://www.gnu.org/licenses/agpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"9e0e0908348ff4fbb75f5f742d3e46927685ba55","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.15","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.6","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-develop.3_1634318647306_0.4108626613124913","host":"s3://npm-registry-packages"}},"1.0.1-develop.4":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-develop.4","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-develop.4","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"6d902a727fc62c3631e4ca7142d3acafef8620dc","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-develop.4.tgz","fileCount":47,"integrity":"sha512-oAKjkRqctUw2rUAQ/0PRGr3i+sKIETcz+NxB9mqknmTVMjIrBoL5R+EivvIIs0g9GAycYlQTb3Pjz2bAYzjVwQ==","signatures":[{"sig":"MEYCIQDE9FFFNPJwm+5Ulva9pizIGQhWVM4klzRL2SVWCycSPAIhAPrfrLJVI6ib64DPmEB5cqYy/fz/6vxYz3EAuGkapnHt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11070517,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh3bmKCRA9TVsSAnZWagAAGB4P/jPNAz4wzi23fl87/WrS\ngLuoAF/KXXs6ZU+YPptitbq851MKzKxxteLTCaI4FyOYrJxPkiEbGFxTHBhv\n/y1p9otwhRxXXZbvw8b1G6po1hVkUkCHcIv4Ia0pAwFFEokGIWghTZJ7ICO1\nVXLGdP7rNxmJE7n/TAPdPIBm0443hrYXjya5Xjrg69RbKx+bb2obp3k1JBCp\n5Hy4XSfLAhjuN81ZvSA4MbvbKVPenvgHFAP45EDIKh3jAs9M69YCh8CxB/SG\na0R2R2YuwjgRopVR2HzT8iEYNQkyN14fFZ6z/k88Adr5+77R3MrG0w2fFzoV\n0gb9U2Kx/aV776XEqEWizZCMDdAput2Q8digVi+JCb7e6TfRdnwYQ/82tco4\nqH2X+hQU+KbMp2Snv01r08ggcyD6X5la8W1c4dzmRe6NAlKVSr/CTXX3b/11\nNTpsPwcepkw1bw2r0Ou6qn0nZah7GTNn0+p+uCX4uQyXZcOj4X/l77TkLmth\n9EN3P5WQRq5zGzVSUYwRrB07AHQJODLRKdElv/CxFoYZjLdzgSEK8L8mwoJG\njcgmc3magvqlV9WouFsmE0Qx97T2n//bjb+BwdntqnpLVQjxTjA4r6hVXat3\nsIFnyCB7duKIyISovH1y5VQ1NBqOYvcyn8nXhLWgxgkEHHrXF7cibUvGcBBN\nOJ7I\r\n=6aij\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: could be called only by sChain owner\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(ownerAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` ownerAddress     | sChain owner address                                        |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Lesser General Public License v3](https://www.gnu.org/licenses/lgpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"f433a3bb5d18edd8e8b7c0c8207c01e2d39829ea","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then dd if=/dev/urandom of=./test/data/test.txt bs=1048576 count=100; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857600"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.15","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"12.22.8","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-develop.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-develop.4_1641920905661_0.48511882544738105","host":"s3://npm-registry-packages"}},"1.0.1-develop.5":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-develop.5","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-develop.5","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"78cc8eee6bb12470a79f8490495c2100b5c9417b","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-develop.5.tgz","fileCount":48,"integrity":"sha512-2ayNriNapA/cOucao6mWDFpGU+MTkzY6ya5sgSmAoCFuqF/y6oXouAo83WB/KCTR5mJdrNrK7fqZJ2jD0AHBRA==","signatures":[{"sig":"MEUCIQCo1BCgJJKxyd2t4TaYMySxEJAv79u/CQXj25db9uDjOAIgE+QN+ECJ3TRBYJoRY96EbiJW+a3hYQuEp5Qjlb32f+o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11079219,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiWJQRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQTA//Y1ihdV7JMHtMp2rsxsqY8Seks6u3rdO1Uw77vhFVg8G9N5V1\r\nTkjyPhi3Yn4rgMIfijLtFNHIiz8hdFHLJ9Zo+gyib7qCisa/OCvP/PRzj9xW\r\nXfeYpzQpQzXB/UXToPVL2aoTII0f611qi/1wMbOzBmlcWBM9vVeGM5N4LFIr\r\nlHLrVvn+bFu0zjnSj3oocb1b5iPmr+Iw51QLmIEeq0fpgYTrduECq1cEn7Lz\r\nUwWHvxjvK7Y8YM6JbF+/zCF3w5z4hoO7ysyFuaAh3MuP+y1sn0vOH2epqwkX\r\nd+Myz0JU4pXtFvz+2wctgNtwEtyiSBI8uD7NrftRAILbrbu/k2gx/xq0sASn\r\n+TQ+RPbbgAQXCnIJrSIphHCbyOaQO9sEtxjoZa4hxeDryvYxHHJoPspiwqoS\r\nX3uVtswlvvbD3KbdBzcxkb/CJFyBJUzf8LgHuEAWn0kSN2H1OXg7ll/7r56L\r\nZNRnDC8z1SR8qv7rVALWELPVIdUNwTGAYveywnndgaJklzP7p7PhT1ZVZ7TS\r\n2U2gLxLAXAs7djtW52Rc1gBSNG2zoXcbRKVbCwfdOpTzH1rSN/GVc4dzaOPo\r\nD95GDNGOmUGmtrsxRihDx70LqhNl3MnQ7rqFFpRCy8+BLzb24KkJ5HZGC599\r\n5cTI8Oa9ytdSdJVBw8hQHcwkO01gt41WEog=\r\n=CPbY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: can be called only by ALLOCATOR_ROLE (or schain owner in v1 chains)\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` allocatorAddress | Address with ALLOCATOR_ROLE                                 |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Grant allocator role\n\nGranting allocator role to be able to reserve space in Filestorage\n\n-   **Note**: can be called only by ADMIN_ROLE (on v2+ chains)\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\nGrant allocator role using external signing (Metamask etc):\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` adminAddress     | DEFAULT_ADMIN address                                       |\n| `String` allocatorAddress | Address to grant role for                                   |\n| `String` adminPrivateKey  | _(optional)_ DEFAULT_ADMIN private key, to sign transactions|\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Lesser General Public License v3](https://www.gnu.org/licenses/lgpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"02ac546aeab02b97515ff8c7aef861a1ce5c5a22","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then head -c 104857601 /dev/urandom > ./test/data/test.txt; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857601"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.16","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"14.19.1","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-beta.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-develop.5_1649972240960_0.38673449891119915","host":"s3://npm-registry-packages"}},"1.0.1-develop.6":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-develop.6","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-develop.6","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"1b2d2b2d2dd8be3560ee68480e312b547eb84f42","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-develop.6.tgz","fileCount":48,"integrity":"sha512-Yy848z/nwped6t25X6QJj9xxDoQkRagHsDtwbzjlafxsjoMM/sRmdz5onwMqpMuijooFJVAcbxiftyQIb9CZdg==","signatures":[{"sig":"MEYCIQDt90G9EaEitQ88eHvKGkYsCZttMWlJpoPPevMkOl7bmwIhAOmSw4M2LwKt0R4e04wgbJfFk/PL3pq21SCbNNoxXtuz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11079219,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi65swACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmofGg/8DhkvJ73ZDIIgtQjwYBqWkKol4Oy+i+VQgTR5zQTMk3UasVGW\r\ndjSSDQ64gRoO9z4amycrReV0kI6Fflw/XrFk7SyDXFwTuAxmeSbuKBraSxod\r\nlFx8w0qyS/4dPfMuRlJbnoewqYQnB5x/cofgFpv+oUN4/zq6ths9DExmFW1l\r\nFe4IJqP6W3ZFmrpgDOLuyEf51x4dI9ZkT35gbn31sp/2dkjUnZ87w4PGnXCE\r\nqq3IabKuE+MEOcydrv5mqz0ynQUAq+zoIRdm48qO5W6v8z6VqHLoJWv7+lqV\r\nqtqSIWgn4rFDPGzj9bjVx6j/6nP3dAmbSplwm39Ob2WhIEWOQ/O7WCCCEEyK\r\nBlgyQK0F1eb3Q3EhejgW3dKu0GcveUBvlBTErxc/f1gAt30Ob9nh4m83eTaC\r\nHeI7mgZ/Hx3TnjFT4j4JJY6SF9dMUSwOkpPGdUB3NwLFLMPsgj0nI9lfvxu6\r\nDf+tyr0C7LKpD1J81D/GRo3WG+i+VgpLPuXSwGNAUEOKb89aBIQxUEIyB9AO\r\n1JIhEgUokkIWYRXOeQxowtnOUln9hvNi2Kx4GjcQQk6brIVTEh0eYYIIk/2A\r\nSlPnQSuFYNbBjBC9rlPe0ETRIBsycYDyH5evq7w6asYMrTPG/1mmtqftT2wE\r\nXxtYngDkGByD/HgRUHbwVoI031XbkSOPNI0=\r\n=qgQs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: can be called only by ALLOCATOR_ROLE (or schain owner in v1 chains)\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` allocatorAddress | Address with ALLOCATOR_ROLE                                 |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Grant allocator role\n\nGranting allocator role to be able to reserve space in Filestorage\n\n-   **Note**: can be called only by ADMIN_ROLE (on v2+ chains)\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\nGrant allocator role using external signing (Metamask etc):\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` adminAddress     | DEFAULT_ADMIN address                                       |\n| `String` allocatorAddress | Address to grant role for                                   |\n| `String` adminPrivateKey  | _(optional)_ DEFAULT_ADMIN private key, to sign transactions|\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Lesser General Public License v3](https://www.gnu.org/licenses/lgpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"f3ece2df105dfa8cc52ee958a40539998bf69702","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then head -c 104857601 /dev/urandom > ./test/data/test.txt; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857601"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.17","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"14.20.0","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-beta.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-develop.6_1659607856337_0.7138822836466119","host":"s3://npm-registry-packages"}},"1.0.1-develop.7":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-develop.7","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-develop.7","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"5047ccfd5a93210fa09727f8b60b2fbd337292c0","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-develop.7.tgz","fileCount":48,"integrity":"sha512-Dz3K60rM0YMfxv4oy/Tv1Gsh9yoBRiOqvWptJeLS3x1gGeBsGEm1go3Y5aL1RyGzGEQFaX0Y8G9pew3C8DsP0g==","signatures":[{"sig":"MEUCIHovYzIcVk8vnLpwaWb8jjRE6Ejq3Uj51bQWMwa0/L8wAiEA1jY2FcX8ZkaDtaY19EfsPSLwm8w9W0Y+CIQUkMyeC1I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11079219,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjEPCaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq4fQ//VaAzCOUFicAWceFD/I7qSzyEllyxD6PVcvdFMHmZJ8sSJFbn\r\nqP6zGYdW2jF8f05aBKQENXSRnrrO1NYHFUCrbhxggkzgNuLA2F5Om8C71PMx\r\nejUJFwspkmCdWE8TLx7CIJXpiMnsewwmbod0LHlBq/9BDL3gH7d6bBIUvyNL\r\nATI02G0JdVtzyyjUu9NmupbGTgGJ6ewtRLOZ5EQTHIB7rAqMqDo2oKp22kuT\r\ncUBFznIpvB5+M36RA6oGhYXpiGUS9Jr6rWymYLlo9HIHIJR9IyeYrVGy96zl\r\nmj0QqR2mvjssnapYu4yK3C5pBDqi7mIE82rbEpRYRAjNOxJjJlzY8tSby0zy\r\nw5wIdksxg2NrwgEUAxPxiM+WJp3kS/jGRIZjuwPxzrw4VMOXR2NKn9mSX8bL\r\n2ZcVHSc4sHZmoehmsX7wZc83iDrLUvHLUBGhKSrbNCBUaJp4T7ajBtaE2ZCC\r\nrG3xsmfWQBGjcUJTFOFt9XD80Gm6HVG8/JbE95EwDQCU/URwDMq7kkggdOQh\r\n8PbOBE5fvZpLpKfSDlxicVVASvkOHosuqu+NhudB10jk5S/GYIBnaBTTwrgJ\r\ncMwXO9TgvhvzCoRJL4gmpU1T9MSUDEdK+U9VCW7dX9RsaIOVsQvL6RY6sKt3\r\nLfIgNMDhYqsrDvU775JjHuP/LFNNeq16V04=\r\n=Df88\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: can be called only by ALLOCATOR_ROLE (or schain owner in v1 chains)\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` allocatorAddress | Address with ALLOCATOR_ROLE                                 |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Grant allocator role\n\nGranting allocator role to be able to reserve space in Filestorage\n\n-   **Note**: can be called only by ADMIN_ROLE (on v2+ chains)\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\nGrant allocator role using external signing (Metamask etc):\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` adminAddress     | DEFAULT_ADMIN address                                       |\n| `String` allocatorAddress | Address to grant role for                                   |\n| `String` adminPrivateKey  | _(optional)_ DEFAULT_ADMIN private key, to sign transactions|\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Lesser General Public License v3](https://www.gnu.org/licenses/lgpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"d429b3d70d39121a5104edffa1fbb41c33aab3aa","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then head -c 104857601 /dev/urandom > ./test/data/test.txt; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857601"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.17","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"14.20.0","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-beta.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-develop.7_1662054553795_0.6945536812210309","host":"s3://npm-registry-packages"}},"1.0.1-beta.0":{"name":"@skalenetwork/filestorage.js","version":"1.0.1-beta.0","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1-beta.0","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"7cdde3e6d2e9414b4431ac92f697f2cc5b4da8f3","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1-beta.0.tgz","fileCount":48,"integrity":"sha512-mVD8yuQxkMFeFPKgvA6+w685XH+Xw6ZGjQ/oLW7Bnn1y8w3+7rGoIedD+XbVbQxKjgxPOQQTlOAuZ3bFk/4W2Q==","signatures":[{"sig":"MEUCIQD44pY0HTIiJ1zwHbUIc49ZJRue0MBh00c37HvsJqj29gIgAMTJpbaJK7ScaECdIWCAdDiItl5tIQonfU6i7bx0PmM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11079216,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjEPQvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdwA//Zl0+vimsqoB3NGiZotKi6iqCUMCwqB3seeXybxbakvycVF2v\r\nz3GfaBQwugn7pnwMfVj8h75ndKObBlVSmh5xyJGoPM2u6YsUy4HUg07SoC4D\r\ny0OCj4TzfP22Qpulsbepri4vqgp00Yw7wO081Ezmmj7IaNaHVLqRjzm1EUhN\r\nn4PLrRrOqpu63Xq7LTah7wTjidBvADdx5qYvT5CDF11LJiETe4icDV8cPfuU\r\n19TXGXbCySutOq3BVsTg9KMwpesGC8X5ANhZodA5WsdOkfc2ncfR3sCAqD3D\r\naQAcYsLrFp4g5hof974GNgT5KCEGSYWMdvSRCga1tFFuRZCt0YcwzXX0ctbS\r\nbFgcd22LhI//Lv1IU6ph+1ug012c8xS7uo5Pv3lmwxZnKrET3Aby8dFRuib/\r\nCe83m4YcuCIRY2Ijzp9M93/BIArNKK8/LALLYXu8RlWUQf+WFvOFOaetRj2p\r\nXLnxArI7KTReJ9UZn0crgxxNHqMBDeOjT7TwLazEF5GgbvCcueYc8QNjpAVq\r\n53w5idlIrxQcixd8vQmwo+xUsgzc6KGC1PHK9Foju8h1QeJk5I6TT0vMAR6z\r\njIpgLKW6/DQGKT0joNTYO/bxDemuBrDgPQFJIsS+HIz0ze7pTlQqi30aDlFk\r\nqEHmsnxkQI8XfmH5jpPUMNrp1iKq3rHou+8=\r\n=qSGX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: can be called only by ALLOCATOR_ROLE (or schain owner in v1 chains)\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` allocatorAddress | Address with ALLOCATOR_ROLE                                 |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Grant allocator role\n\nGranting allocator role to be able to reserve space in Filestorage\n\n-   **Note**: can be called only by ADMIN_ROLE (on v2+ chains)\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\nGrant allocator role using external signing (Metamask etc):\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` adminAddress     | DEFAULT_ADMIN address                                       |\n| `String` allocatorAddress | Address to grant role for                                   |\n| `String` adminPrivateKey  | _(optional)_ DEFAULT_ADMIN private key, to sign transactions|\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Lesser General Public License v3](https://www.gnu.org/licenses/lgpl-3.0.en.html). See [LICENSE](LICENSE).\n","gitHead":"7480b2d505b395622e70dbe4acc38f25d8676e15","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then head -c 104857601 /dev/urandom > ./test/data/test.txt; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857601"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.17","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"14.20.0","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-beta.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1-beta.0_1662055471228_0.5867973848094488","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@skalenetwork/filestorage.js","version":"1.0.1","keywords":["SKALE","ethereum","blockchain"],"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0-only","_id":"@skalenetwork/filestorage.js@1.0.1","maintainers":[{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},{"name":"dmitrytk","email":"dmitry.tkachuk@skalelabs.com"},{"name":"cstrange","email":"chadwick@skalelabs.com"},{"name":"skalelabsdev","email":"dev@skalelabs.com"},{"name":"theskyunicorn","email":"christine@skalelabs.com"},{"name":"stebaev","email":"dimastebaev@gmail.com"},{"name":"l_sergiy","email":"sergiy@skalelabs.com"}],"homepage":"https://github.com/skalenetwork/filestorage.js#readme","bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"dist":{"shasum":"41220df3e7dac430ab5d4de6d729a8384c43d272","tarball":"https://registry.npmjs.org/@skalenetwork/filestorage.js/-/filestorage.js-1.0.1.tgz","fileCount":48,"integrity":"sha512-icyJOCGlZJqamE5lfgFmNH3YmeaMSaODto+fnJWRanu2ulIVnRXm8Kr6/8rOPfW+tGBZ7VXrUSI21zSfzKQQlw==","signatures":[{"sig":"MEYCIQC6mZUxSgr6AgJsPFfJZQgDNBkDsPTiEeGaBI9oB4kKBQIhAPo6hmR+En+nT/5i/UZYHiOakGbsto6zfoAqbG5K+siz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11079209,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjEPW5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNNBAAhmsY57c3zfhxy14Uj0+SF0HhncApsjbrLGQrEqOe8z74xjUc\r\nyRlA0B4ZZ7uv1N2xWnAiMEzDoHMeqiB2cEk4KQJwYBQ4kKrIPH3wimrhgy3X\r\nKgtCl0e3pzza4K8fYz8X1vn8biBtGvtlFT9ykTrpL56w6/bngagtSRoWGQi6\r\n3JYwrE4iJ1/sKvZFdLSXoC9lCK6JtEJ1UnTvR+RosPEXPKwJ7lHGIShz8c0u\r\n/yussbmuj00aOhtdpME64svFxXX33XXRKW1TqRWBWBYykmMDFwFu/kyp4Bmy\r\nb86UTG2BBcFRUWv3G5kz15ht6FFu84kQHBnlXfToAm/xWshdCElFaiTlMaai\r\nqFAj++2VKLZV/aOKYYnHTtGxh5rahJqLHDc8iKUkX/03Fn1RXhebngKe51EE\r\nIIsb4p5P0p5AyjX6ZMBJyVDwpsolg10wyAzqG5NOvQbs6vexUZo+zroliAul\r\njs6XvdyFuLDBXe6tKgQR8u38N4Nzck8ZTtFYpDBZpMqEVNvVwsLDmb1y09bI\r\nKSmBPZgv5xjgtdfK3d+VuT50TNoBMKpDF21Ulq5wZrMy+KD3d9Ab4tMjl5Qo\r\nwHsy0fiihgq61LQvLOlPl4pBMGY8Ndhc1zgwmtNmc+vgjd2GiZ+BwviYFrr+\r\nhqXJbzgYuQrI150Pzzt/AHWUi/neJud8/wo=\r\n=qcSj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"4cc9185345d7156f4417887d7489db6095688f3e","scripts":{"lint":"eslint --cache \"src/**/*.js\" \"test/**/*.js\"","test":"nyc --reporter=lcov mocha --exit --timeout 120000","minify":"WEBPACK_ENV=build npx webpack","version":"node -e \"console.log(require('./package.json').version);\"","coverage":"codecov","generate":"if [ ! -f test/data/test.txt ]; then head -c 104857601 /dev/urandom > ./test/data/test.txt; fi","lint-fix":"npm run lint -- --fix","generate-win":"IF NOT EXIST .\\test\\data\\test.txt fsutil file createnew .\\test\\data\\test.txt 104857601"},"_npmUser":{"name":"rikon","email":"dmytro.nazarenko@skalelabs.com"},"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"_npmVersion":"6.14.17","description":"SKALE Filestorage client tools","directories":{},"_nodeVersion":"14.20.0","dependencies":{"web3":"1.2.6","streamsaver":"^1.0.1","@skalenetwork/filestorage":"1.0.1-beta.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.0.1","chai":"^4.2.0","mocha":"^7.1.1","dotenv":"^8.2.0","eslint":"^6.4.0","codecov":"^3.3.0","webpack":"4.43.0","babel-core":"^6.26.3","webpack-cli":"^3.3.6","babel-eslint":"^10.0.1","babel-loader":"^8.1.0","chromedriver":"80.0.1","randomstring":"^1.1.5","eslint-loader":"^4.0.0","chai-as-promised":"^7.1.1","selenium-webdriver":"^4.0.0-alpha.7","eslint-plugin-jsdoc":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/filestorage.js_1.0.1_1662055864833_0.7327655200835634","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-04-18T14:14:22.101Z","modified":"2025-07-09T16:57:55.374Z","0.2.0":"2019-04-18T14:14:22.582Z","0.2.1":"2019-04-18T14:28:04.492Z","0.2.2":"2019-04-19T12:18:23.388Z","0.2.3":"2019-08-21T14:40:42.074Z","0.2.4":"2019-09-07T14:20:52.042Z","0.2.5":"2019-09-07T21:44:59.215Z","0.2.6":"2019-09-09T14:04:21.089Z","0.2.7":"2019-09-20T12:43:01.591Z","0.2.8":"2019-11-07T15:11:33.952Z","0.2.9":"2020-02-14T10:41:22.031Z","0.2.9-dev.1":"2020-02-14T14:00:13.467Z","0.2.10":"2020-02-14T17:35:35.994Z","0.2.11-develop.0":"2020-09-29T15:10:31.006Z","0.2.11-develop.1":"2020-10-02T10:41:40.585Z","0.2.11-develop.2":"2020-11-10T09:46:12.485Z","0.2.11-develop.3":"2021-05-12T12:42:07.038Z","0.2.11-develop.4":"2021-05-21T11:40:35.047Z","0.2.11-develop.5":"2021-06-03T14:08:55.314Z","0.2.11-develop.6":"2021-06-08T16:15:58.475Z","0.2.11-beta.0":"2021-07-21T09:25:01.781Z","0.2.11-develop.7":"2021-07-21T09:25:21.373Z","0.2.11-beta.1":"2021-07-21T09:36:22.521Z","0.2.11":"2021-07-21T09:41:10.312Z","1.0.0-develop.0":"2021-08-30T14:31:47.725Z","1.0.0-develop.1":"2021-09-01T10:05:41.296Z","1.0.0-develop.2":"2021-09-14T15:41:38.864Z","1.0.0-beta.0":"2021-09-14T15:55:54.575Z","1.0.0":"2021-09-14T16:15:55.763Z","1.0.1-develop.0":"2021-09-16T10:59:08.358Z","1.0.1-develop.1":"2021-09-23T09:58:12.121Z","1.0.1-develop.2":"2021-10-08T08:38:25.869Z","1.0.1-develop.3":"2021-10-15T17:24:07.676Z","1.0.1-develop.4":"2022-01-11T17:08:26.079Z","1.0.1-develop.5":"2022-04-14T21:37:21.324Z","1.0.1-develop.6":"2022-08-04T10:10:56.742Z","1.0.1-develop.7":"2022-09-01T17:49:14.150Z","1.0.1-beta.0":"2022-09-01T18:04:31.668Z","1.0.1":"2022-09-01T18:11:05.184Z"},"bugs":{"url":"https://github.com/skalenetwork/filestorage.js/issues"},"author":{"name":"SKALE Labs and contributors"},"license":"LGPL-3.0-only","homepage":"https://github.com/skalenetwork/filestorage.js#readme","keywords":["SKALE","ethereum","blockchain"],"repository":{"url":"git+https://github.com/skalenetwork/filestorage.js.git","type":"git"},"description":"SKALE Filestorage client tools","maintainers":[{"email":"dmytro.nazarenko@skalelabs.com","name":"rikon"},{"email":"dmitry.tkachuk@skalelabs.com","name":"dmitrytk"},{"email":"dimastebaev@gmail.com","name":"stebaev"}],"readme":"# SKALE Filestorage.js\n\n[![npm version](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js.svg)](https://badge.fury.io/js/%40skalenetwork%2Ffilestorage.js)\n[![Build Status](https://travis-ci.com/skalenetwork/filestorage.js.svg?branch=develop)](https://travis-ci.com/skalenetwork/filestorage.js)\n[![codecov](https://codecov.io/gh/skalenetwork/filestorage.js/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/filestorage.js)\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\nJavascript library which implements client for decentralized file storage on SKALE chains.\n\n-   Node.js v10, 12, and v14 support\n\n## Install\n\nRun the following command:\n\n```sh\nnpm i --save @skalenetwork/filestorage.js   \n```\n\n## Usage\n\nTo use **Filestorage.js** you should have **SKALE endpoint**. \n\nExample: `http://some.local-or-remote.node:8546`\n\n### Initiating of Filestorage\n\nConstruct new **Filestorage** object:\n\n```javascript\nnew Filestorage(web3Provider, enableLogs);\n```\n\n#### Parameters\n\n| Parameter                                  | Description                                                                                                               |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| <code>String \\| object</code> web3Provider | URL of **SKALE endpoint** or one of the [Web3 provider classes](https://web3js.readthedocs.io/en/1.0/web3.html#providers) |\n| `boolean` enableLogs                       | _(optional)_ Enable/disable console logs                                                                                  |\n\n##### Example\n\nInitialize with **SKALE endpoint**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nlet filestorage = new Filestorage('----SKALE ENDPOINT----');\n```\n\nInitialize with external **web3 provider**:\n\n```javascript\nconst Filestorage = require('@skalenetwork/filestorage.js');\nconst Web3 = require('web3');\n\nconst web3Provider = new Web3.providers.HttpProvider('----SKALE ENDPOINT----');\nlet filestorage = new Filestorage(web3Provider);\n```\n\n### Using in HTML\n\nTo use filestorage.js in HTML you should import `filestorage.min.js` from npm package:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n```\n\n**Example**:\n\n```html\n<script src=\"PATH_TO_PACKAGE/@skalenetwork/filestorage.js/dist/filestorage.min.js\"></script>\n<script type=\"text/javascript\">\n    async function downloadFile() {\n        let fs = new filestorage('----SKALE ENDPOINT----', true);\n        await fs.downloadToFile('----STORAGEPATH----');\n    }\n</script>   \n```\n\n#### Upload file\n\n Upload file using internal signing:\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer, privateKey);\n```\n\n Upload file using external signing (Metamask, etc.):\n\n```javascript\nfilestorage.uploadFile(address, filePath, fileBuffer);\n```\n\n##### Parameters\n\n| Parameter           | Description                                                       |\n| ------------------- | ----------------------------------------------------------------- |\n| `String` address    | Account address                                                   |\n| `String` filePath   | Path of uploaded file in account directory                        |\n| `Buffer` fileBuffer | Uploaded file data                                                |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions internally |\n\n##### Returns\n\n|   Type   | Description                                 |\n| :------: | ------------------------------------------- |\n| `String` | [Path of file in Filestorage](#storagePath) |\n\n#### Download file\n\nDownload file from Filestorage into browser downloads folder:\n\n```javascript\nfilestorage.downloadToFile(storagePath);\n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n#### Download buffer\n\nDownload file from Filestorage into buffer\n\n```javascript\nfilestorage.downloadToBuffer(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                 |\n| -------------------- | ------------------------------------------- |\n| `String` storagePath | [Path of file in Filestorage](#storagePath) |\n\n##### Returns\n\n|   Type   | Description  |\n| :------: | ------------ |\n| `Buffer` | File content |\n\n#### Delete file\n\nDelete file using internal signing:\n\n```javascript\nfilestorage.deleteFile(address, filePath, privateKey);\n```\n\nDelete file using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteFile(address, filePath);\n```\n\n##### Parameters\n\n| Parameter           | Description                                            |\n| ------------------- | ------------------------------------------------------ |\n| `String` address    | Account address                                        |\n| `String` filePath   | Path of the file in account directory to be deleted    |\n| `String` privateKey | _(optional)_ Account private key, to sign transactions |\n\n#### Create directory\n\nCreates directory on the specific path. To create directory using internal signing:\n\n```javascript\nfilestorage.createDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.createDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be created                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n##### Returns\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n#### Delete directory\n\nDeletes directory on the specific path. To delete directory using internal signing:\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath, privateKey);\n```\n\nCreate directory using external signing (Metamask etc):\n\n```javascript\nfilestorage.deleteDirectory(address, directoryPath);\n```\n\n##### Parameters\n\n| Parameter              | Description                                            |\n| ---------------------- | ------------------------------------------------------ |\n| `String` address       | Account address                                        |\n| `String` directoryPath | Path of the directory to be deleted                    |\n| `String` privateKey    | _(optional)_ Account private key, to sign transactions |\n\n#### List directory\n\nLists content of the specific directory\n\n```javascript\nfilestorage.listDirectory(storagePath); \n```\n\n##### Parameters\n\n| Parameter            | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n\n##### Returns\n\n`Array` of content. Each content could be file or directory.\n\nContent `Object` for file contains:\n\n| Field                      | Description                                 |\n| -------------------------- | ------------------------------------------- |\n| `String` name              | File name                                   |\n| `String` storagePath       | [Path of file in Filestorage](#storagePath) |\n| `String` isFile            | Whether content is file                     |\n| `number` size              | File size, in bytes                         |\n| `number` status            | File uploading status                       |\n| `number` uploadingProgress | Upload progress, in percents                |\n\nContent `Object` for directory contains:\n\n| Field                | Description                                      |\n| -------------------- | ------------------------------------------------ |\n| `String` name        | Directory name                                   |\n| `String` storagePath | [Path of directory in Filestorage](#storagePath) |\n| `String` isFile      | Whether content is file                          |\n\n#### Reserve space\n\nReserve space for certain address in Filestorage in bytes.\n\n-   **Note**: can be called only by ALLOCATOR_ROLE (or schain owner in v1 chains)\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace, privateKey);\n```\n\nReserve space using external signing (Metamask etc):\n\n```javascript\nfilestorage.reserveSpace(allocatorAddress, addressToReserve, reservedSpace);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` allocatorAddress | Address with ALLOCATOR_ROLE                                 |\n| `String` addressToReserve | Address to reserve space for                                |\n| `String` reservedSpace    | Reserved space in bytes                                     |\n| `String` privateKey       | _(optional)_ sChain owner private key, to sign transactions |\n\n#### Grant allocator role\n\nGranting allocator role to be able to reserve space in Filestorage\n\n-   **Note**: can be called only by ADMIN_ROLE (on v2+ chains)\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\nGrant allocator role using external signing (Metamask etc):\n\n```javascript\nfilestorage.grantAllocatorRole(adminAddress, allocatorAddress, adminPrivateKey);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` adminAddress     | DEFAULT_ADMIN address                                       |\n| `String` allocatorAddress | Address to grant role for                                   |\n| `String` adminPrivateKey  | _(optional)_ DEFAULT_ADMIN private key, to sign transactions|\n\n#### Get reserved space\n\nGet information about reserved space for account in bytes.\n\n```javascript\nfilestorage.getReservedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Reserved space in bytes                          |\n\n#### Get occupied space\n\nGet information about occupied (actually used) space for account in bytes.\n\n```javascript\nfilestorage.getOccupiedSpace(address);\n```\n\n##### Parameters\n\n| Parameter                 | Description                                                 |\n| ------------------------- | ----------------------------------------------------------- |\n| `String` address          | Account address                                             |\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` occupiedSpace | Occupied space in bytes                          |\n\n#### Get total space in Filestorage\n\nGet information about total space in Filestorage in bytes.\n\n```javascript\nfilestorage.getTotalSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` space         | Total space in Filestorage in bytes              |\n\n#### Get total reserved space\n\nGet information about total reserved space (sum of all reserved spaces) in bytes.\n\n```javascript\nfilestorage.getTotalReservedSpace();\n```\n\n##### Returns\n\n| Parameter              | Description                                      |\n| ---------------------- | ------------------------------------------------ |\n| `Number` reservedSpace | Total reserved space in bytes                    |\n\n## Development\n\n### Install\n\n```bash\ngit clone git@github.com:skalenetwork/filestorage.js.git\ncd filestorage.js\nnpm install\n```\n\n#### Testing\n\nFirst of all, please create random files for testing:\n\n```bash\nnpm run generate\n```\n\nTo run tests locally you need environment variables defining two keypairs (account, foreign account):\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n\nThen execute:\n\n```bash\nnpm test\n```\n\n#### Browser testing\n\nRequirements to run chrome integration tests:\n\n-   Chrome v80\n\nRequired environment variables to run browser integration tests locally:\n\n-   `SKALE_ENDPOINT`: SKALE endpoint\n-   `SCHAIN_OWNER_PK`: SKALE chain owner privatekey\n-   `PRIVATEKEY`: test account privatekey\n-   `FOREIGN_PRIVATEKEY`: second test account privatekey\n-   `SEED_PHRASE`: seed phrase to run metamask tests\n-   `METAMASK_PASSWORD`: password to run metamask tests (> 7 chars)\n\nRun tests:\n\n```bash\nnpm run test test/browser\n```\n\n#### Build a dist version\n\n```bash\nnpm run minify\n```\n\n**Publishing on npm:** \n\n```bash\nnpm publish\n```\n\n#### Versioning\n\nThe version scheme for this repo is `{major}.{minor}.{patch}`. \nFor develop version scheme is `{major}.{minor}.{patch}-develop.{number}`\nFor beta version scheme is `{major}.{minor}.{patch}-beta.{number}`\n\nFor more details see: <https://semver.org/>\n\n#### Lint\n\nConforming to linting rules is a prerequisite to commit to filestorage.js.\n\n```bash\nnpm run lint\n```\n\n## Notes\n\n### Storage path <a name=\"storagePath\"></a>\n\nStorage path is a label used to point to file or directory in Filestorage. It contains 2 parts through slash:\n1. File owner address (without 0x)\n2. File/directory path in owner's root directory\n\nExample:\n\n```bash\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/directoryA/random_text.txt\n77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt\n0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8/random_text.txt #Invalid storagePath\n```\n\n## Contributing\n\n**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**\n\n[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)\n\n## License\n\n![GitHub](https://img.shields.io/github/license/skalenetwork/filestorage.js.svg)\n\nAll contributions are made under the [GNU Lesser General Public License v3](https://www.gnu.org/licenses/lgpl-3.0.en.html). See [LICENSE](LICENSE).\n","readmeFilename":"README.md"}