collection of modules to manage BagIt bags
npm install bagit-tools
var bagitTools = require('bagit-tools')
var bagDir = '/downloads/my-bag'
bagTools.verify(bagDir, function (err, valid, results) {
if (err) throw err
if (valid) console.log('VALID')
else console.log('FAIL')
})
Results is an array of TAP test objects for each verification step. Run against the LOC bagit-conformance-suite with npm test
.
- 1.0 - All passing
- 0.97 - Valid/Invalid Passing, Warnings need some work
- ... earlier version before 0.97 all valid
Read and write from bags with an fs-like API via bagit-fs.
var bagFs = require('bagit-tools').fs
var bag = bagFs('/put/bag/here', 'sha256', {'Contact-Name': 'Joe Hand'})
// write files to bag's data folder
fs.createReadStream('readme.md').pipe(bag.createWriteStream('/readme.md'))
// ... LATER after all files are written
bag.finalize(function () {
console.log('finalized')
})
Contributions welcome! Please read the contributing guidelines first.