Comparing version 1.1.0 to 1.1.1
Contact-Name: Joe Hand | ||
Bagging-Date: 2017-04-09 | ||
Bag-Size: 15 KB | ||
Bagging-Date: 2017-07-18 | ||
Bag-Size: 80 KB |
@@ -102,3 +102,2 @@ var assert = require('assert') | ||
hash = digest.digest('hex') | ||
console.log(hash, entry) | ||
if (hash !== entry.checksum) return cb(new Error('File does not match manifest checksum value.')) | ||
@@ -144,3 +143,2 @@ cb(null, result) | ||
name = path.join(self.dataDir, name) | ||
console.log('name', name) | ||
var hash = null | ||
@@ -152,11 +150,9 @@ var digest = crypto.createHash(self.algo) | ||
function (chunk, enc, cb) { | ||
console.log('data') | ||
digest.update(chunk) | ||
cb(null, chunk) | ||
}, // transform is a noop | ||
function (cb) { // flush function | ||
console.log('stream done') | ||
}, | ||
function (cb) { | ||
hash = digest.digest('hex') | ||
// TODO: check if old file hash is in manifest | ||
var data = `${hash} ${path.relative(self.dir, name)}\n` | ||
var data = `${hash} ${path.relative(self.dir, name).split(path.sep).join('/')}\n` | ||
fs.appendFile(self.manifest, data, cb) | ||
@@ -163,0 +159,0 @@ } |
{ | ||
"name": "bagit-fs", | ||
"description": "node fs implementation for bagit format", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": "Joe Hand <joe@hand.email>", | ||
@@ -33,4 +33,5 @@ "bugs": { | ||
"prettier-bytes": "^1.0.3", | ||
"stream-collector": "^1.0.1" | ||
"stream-collector": "^1.0.1", | ||
"through2": "^2.0.3" | ||
} | ||
} |
@@ -45,2 +45,16 @@ # bagit-fs | ||
### Using Finalized Bags | ||
#### `bag.readFile(name, [opts], cb)` | ||
Read a file from a completed bag. File is verified with checksum in manifest unless `opts.verify === false`. | ||
#### `bag.readManifest(callback(err, entries))` | ||
Get all entries in the manifest. | ||
#### `bag.getManifestEntry(name, callback(err, entry))` | ||
Get specific entry `{checksum: <hash>, name: data/file.txt}` in the manifest. | ||
### `fs` API | ||
@@ -52,3 +66,3 @@ | ||
* `bag.mkdir(name, opts, cb)` - make a dir in the `data/` folder. | ||
* `bag.createReadStream(name, opts, cb)` | ||
* `bag.createReadStream(name, opts, cb)` - file is not verified with manifest (yet). | ||
* `bag.mkdir(name, cb)` | ||
@@ -55,0 +69,0 @@ * `bag.stat(name, cb)` |
4542c109a379817f7d848e78624dbd5e41adb2eb2b5c313013bb56127ebcbbb1 data/.travis.yml | ||
7b19faa22b836a51e632a2d5b4221ac50cae9e23bb6a9855641ad8b2a9d8535b data/CHANGELOG.md | ||
b6cf7e424b0214cdb25dc68d207762faa4f15c8ef171ccedf8fa1f3df47c032b data/CONTRIBUTING.md | ||
9637250a6dd0ed7bbe0625878077873c19bb5078eae5d410841a7df567a658c5 data/LICENSE.md | ||
be3fe730ca86356ac9cf153d89c7e97f0324ec83f8510b475bdb179fc3a098be data/README.md | ||
8cb22d3e28195cc96f2c5a6bab8b586eb99f159f942956582793dc0281007839 data/README.md | ||
970b6e50f18d5156266ca96c4a8b22873b7cd2401e527b99a0b874a951f4ce78 data/cli.js | ||
ce87ff3404710e0a0b4275bf65c93d9c1f351206db5dd2b03fa10bb0083120d8 data/index.js | ||
b2e48e66429bbb3f3202fbe762f499aace01868b410f7d6db95b7af988061267 data/index.js | ||
98d3c0d21324e35e1478130f4a424f58f656da4151636ff345251addd5bd891c data/lib/const.js | ||
2871f0c836dc3548e7fe1fb22ecd723b8edeeae878e72c5a15258e00febee6c6 data/package.json | ||
3c25a151f1ea5623f7aa1b6206f26f53c6da65866d175b59a72088be02d1fb07 data/package-lock.json | ||
403c5f8e2049ea447dc133f4463bfc18ef9368e27d595befea2b07716e0acec6 data/package.json | ||
a33adb601d0b1b58b68ff35a03289e9bbbda00c811af84652fb9985a5b222011 data/test/index.js |
@@ -154,3 +154,3 @@ var assert = require('assert') | ||
// TODO: check if old file hash is in manifest | ||
var data = `${hash} ${path.relative(self.dir, name)}\n` | ||
var data = `${hash} ${path.relative(self.dir, name).split(path.sep).join('/')}\n` | ||
fs.appendFile(self.manifest, data, cb) | ||
@@ -157,0 +157,0 @@ } |
{ | ||
"name": "bagit-fs", | ||
"description": "node fs implementation for bagit format", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Joe Hand <joe@hand.email>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
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
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
28503
23
461