erebos-api-bzz-node
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -10,2 +10,6 @@ 'use strict'; | ||
var _fs = require('fs'); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _erebosApiBzzBase = require('erebos-api-bzz-base'); | ||
@@ -25,2 +29,6 @@ | ||
var _tarFs = require('tar-fs'); | ||
var _tarFs2 = _interopRequireDefault(_tarFs); | ||
var _tarStream = require('tar-stream'); | ||
@@ -99,2 +107,38 @@ | ||
uploadTarData(directory) { | ||
const pack = _tarStream2.default.pack(); | ||
Object.keys(directory).forEach(function (key) { | ||
pack.entry({ name: key }, directory[key].data); | ||
}); | ||
pack.finalize(); | ||
return this._fetch(`${this._url}bzz:`, { | ||
method: 'POST', | ||
body: pack, | ||
headers: { | ||
'Content-Type': 'application/x-tar' | ||
} | ||
}).then(res => res.ok ? res.text() : Promise.reject(new Error(res.statusText))); | ||
} | ||
uploadTarFile(path) { | ||
return this._fetch(`${this._url}bzz:`, { | ||
method: 'POST', | ||
body: _fs2.default.createReadStream(path), | ||
headers: { | ||
'Content-Type': 'application/x-tar' | ||
} | ||
}).then(res => res.ok ? res.text() : Promise.reject(new Error(res.statusText))); | ||
} | ||
uploadDirectoryTar(path) { | ||
return this._fetch(`${this._url}bzz:`, { | ||
method: 'POST', | ||
body: _tarFs2.default.pack(path), | ||
headers: { | ||
'Content-Type': 'application/x-tar' | ||
} | ||
}).then(res => res.ok ? res.text() : Promise.reject(new Error(res.statusText))); | ||
} | ||
downloadDirectoryTar(hash) { | ||
@@ -101,0 +145,0 @@ return this._fetch(`${this._url}bzz:/${hash}`, { |
{ | ||
"name": "erebos-api-bzz-node", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Bzz API for node", | ||
@@ -27,8 +27,9 @@ "repository": "git@github.com:MainframeHQ/erebos.git", | ||
"node-fetch": "^2.2.0", | ||
"tar-fs": "^1.16.3", | ||
"tar-stream": "^1.6.1" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "^0.77.0", | ||
"flow-bin": "^0.78.0", | ||
"rxjs": "^6.2.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12712
179
7
3
+ Addedtar-fs@^1.16.3
+ Addedchownr@1.1.4(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedpump@1.0.3(transitive)
+ Addedtar-fs@1.16.3(transitive)