Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
node fs implementation for the bagit spec.
npm install bagit-fs
var BagIt = require('bagit-fs')
var bag = BagIt('/put/my/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')
})
See example/index.js
for an example usage with mirror-folder.
var bag = BagIt(dest, algorithm, [bagInfo])
dest
is the destination directory for the bagalgorithm
is a string specifying which checksum algorithms to use. Default is sha256
.bagInfo
is a object with data to be written to bag-info.txt
, e.g. bagInfo = {'Contact-Name': 'Joe Hand'}
. See below for details on bag-info.txt
.bag.finalize(cb)
Finalize the bag, writing bag-info.txt
and bagit.txt
. Date and size are automatically written to the info. This should only be called when the bag is complete.
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
APISeveral of the node fs
functions are implemented allowing you to create or read from bags like the fs. Most of these just wrap the fs
calls to act on the bag's data
folder.
bag.createWriteStream(name, opts, cb)
- writes file to bagDir/data
and the checksum hash to the manifest.bag.mkdir(name, opts, cb)
- make a dir in the data/
folder.bag.createReadStream(name, opts, cb)
- file is not verified with manifest (yet).bag.mkdir(name, cb)
bag.stat(name, cb)
bag.lstat(name, cb)
bag.readdir(name, cb)
bag.unlink(name, cb)
bag.rmdir(name, cb)
bagit-fs
is a fully compliant implementation of the specification but there are some optional parts not yet implemented.
The "bag-info.txt" file is a tag file that contains metadata elements describing the bag and the payload. The metadata elements contained in the "bag-info.txt" file are intended primarily for human readability. All metadata elements are optional and MAY be repeated.
Bagging-Date
and Bag-Size
are written automatically on bag.finalize()
.
Here is an example "bag-info.txt" file:
Source-Organization: Spengler University
Organization-Address: 1400 Elm St., Cupertino, California, 95014
Contact-Name: Edna Janssen
Contact-Phone: +1 408-555-1212
Contact-Email: ej@spengler.edu
External-Description: Uncompressed greyscale TIFF images from the
Yoshimuri papers colle...
Bagging-Date: 2008-01-15
External-Identifier: spengler_yoshimuri_001
Bag-Size: 260 GB
Payload-Oxum: 279164409832.1198
Bag-Group-Identifier: spengler_yoshimuri
Bag-Count: 1 of 15
Internal-Sender-Identifier: /storage/images/yoshimuri
Internal-Sender-Description: Uncompressed greyscale TIFFs created
from microfilm and are...
FAQs
node fs implementation for bagit format
The npm package bagit-fs receives a total of 0 weekly downloads. As such, bagit-fs popularity was classified as not popular.
We found that bagit-fs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.