FileSystemWriter

FileSystemWriter

FileSystemWriter writes files directly to the file system. Use this for creating unserialzed bags.

Constructor

new FileSystemWriter(pathToOutputDir)

Creates a new FileSystemWriter.

Parameters:
Name Type Description
pathToOutputDir string

The path to the directory that you want to write files into.

Source:

Members

pathToOutputDir :string

pathToOutputDir is the path to the directory into which the FileSystemWriter will write its files.

Source:

Methods

(static) description() → {PluginDefinition}

Returns a PluginDefinition object describing this plugin.

Source:

add(bagItFile, cryptoHashes)

Writes a file into the directory. This method is asynchronous, emitting events 'fileAdded' when it's done writing a file.

Files will be written in the order they were added. You'll get errors if bagItFile.absSourcePath does not exist or is not readable.

Parameters:
Name Type Description
bagItFile BagItFile

The BagItFile object describing the file to be added into the output directory.

cryptoHashes Array.<crypto.Hash>

An array of Node.js crypto.Hash objects used to calculate checksums of the files being written onto the file system. All digests are calculated during the write, so adding multiple hashes will not lead to multiple end-to-end reads of the input stream.

You can omit this parameter if you don't care to calculate checksums. If present, the digests will be written into the bagItFile.checksums object. For example, if cryptoHashes includes md5 and sha256 Hash objects, bagItFile.checksums will come out looking like this:

Source:
Example
bagItFile.checksums = {
    'md5': '1234567890',
    'sha256': '0987654321'
}