Gladstone: a node.js based BagIt utility

Gladstone: a node.js based BagIt utility

Gladstone is a node.js command line utility and library that I wrote for creating BagIt archives.

BagIt archives are standard for storing and transferring content. There are widely-deployed open source utilities written for the standard in Python, Ruby, and Java. The Java and Python libraries are maintained by the Library of Congress, which is a big user of the BagIt standard.

In its current implementation Gladstone bags whole directories recursively and then moves the resulting bag to another destination. The Python implementation of BagIt does what’s called “bag in place” style bagging. It will create the bag in the folder you give it. This may not be what you want if you don’t want the folder you are creating your bag from to be a bag itself.

Gladstone is simpler than the other utilities, but I hope that may end up being helpful for someone who needs to do bagging in JavaScript.

To use the command line utility you’ll need to install the node module globally:

nam install -g gladstone

Then you can use the CLI interface:


gladstone --bagName ~/bagname --originDirectory ~/source --cryptoMethod md5 

If you want to use it as a library you can require it in your node.js app:

var gladstone = require('gladstone');

gladstone.createBagDirectory({ bagName: '/path/to/new/bag',
                               originDirectory: '/path/to/dir/to/bag',
                               cryptoMethod: 'sha256',
                               sourceOrganization: 'Example Organization',
                               organizationAddress: '123 Street',
                               contactName: 'Contact Name',
                               contactPhone: '555-555-5555',
                               contactEmail: '',
                               externalDescription: 'An example description'