Class: Shards

Shards

Convenience wrapper for storing shards scoped to a directory

new Shards(directory)

Parameters:
Name Type Description
directory string Directory path to shard storage
Source:

Methods


createReadStream(key, callback)

Wraps read stream with error handling/callback
Parameters:
Name Type Description
key string The file key or hash
callback Shards~createReadStreamCallback
Source:

createWriteStream(key, callback)

Wraps write stream with error handling/callback
Parameters:
Name Type Description
key string The file key or hash
callback Shards~createWriteStreamCallback
Source:

exists(key, callback)

Check if the shard exists
Parameters:
Name Type Description
key string
callback Shards~existsCallback
Source:

size(callback)

Get used space and remaining allocation
Parameters:
Name Type Description
callback Shards~sizeCallback
Source:

Unlink the shard from the file system
Parameters:
Name Type Description
key string
callback Shards~unlinkCallback
Source:

Type Definitions


createReadStreamCallback(error, stream)

Parameters:
Name Type Description
error error | null
stream object
Source:

createWriteStreamCallback(error, stream)

Parameters:
Name Type Description
error error | null
stream object
Source:

existsCallback(error, exists)

Parameters:
Name Type Description
error error | null
exists boolean
Source:

unlinkCallback(error)

Parameters:
Name Type Description
error error | null
Source: