Class: Btable

Btable(tablePath, optionsopt)

Represents the primary interface for the KFS file store

Constructor

new Btable(tablePath, optionsopt)

Constructs series of Sbuckets composing a sharded table
Parameters:
Name Type Attributes Description
tablePath String The path to the directory to store the table
options Object <optional>
Properties
Name Type Attributes Description
referenceId String <optional>
R bit hex reference ID
maxTableSize Number <optional>
Max bytes to cap the database
sBucketOpts Object <optional>
Options to pass to Sbucket
Source:

Methods

createReadStream(key, callback)

Creates a readable stream of the data at the given key
Parameters:
Name Type Description
key String The key for the data read
callback Btable~createReadStreamCallback
Source:

createWriteStream(key, callback)

Creates a writable stream to the given key
Parameters:
Name Type Description
key String The key to write the data to
callback Btable~createWriteStreamCallback
Source:

exists(key, callback)

Check if a file exists at the supplied key
Parameters:
Name Type Description
key String The key to check for existence
callback Sbucket~existsCallback
Source:

flush(callback)

Performs a flush on each S-bucket in the table to free any dead space
Parameters:
Name Type Description
callback Btable~flushCallback
Source:

list(keyOrIndex, callback)

Lists the file keys in the given bucket
Parameters:
Name Type Description
keyOrIndex Number | String The bucket index of a file key
callback Sbucket~listCallback
Source:

readFile(key, callback)

Reads the data at the supplied key into a buffer
Parameters:
Name Type Description
key String The key for the data to read
callback Sbucket~readFileCallback
Source:

stat(keyOrIndexopt, callback)

Lists the created Sbuckets and their sizes
Parameters:
Name Type Attributes Description
keyOrIndex String | Number <optional>
Optional bucket index or file key
callback Btable~statCallback
Source:
Unlinks the data for the given key
Parameters:
Name Type Description
key String The key to unlink data from
callback Sbucket~unlinkCallback
Source:

writeFile(key, buffer, callback)

Writes the given buffer to the key
Parameters:
Name Type Description
key String The key to write the data to
buffer Buffer The raw buffer to write to the key
callback Sbucket~writeFileCallback
Source:

Type Definitions

createReadStreamCallback(erroropt, readStream)

Parameters:
Name Type Attributes Description
error Error <optional>
readStream ReadableStream
Source:

flushCallback(error)

Parameters:
Name Type Description
error Error | null
Source:

statCallback(erroropt, sBuckets)

Parameters:
Name Type Attributes Description
error Error <optional>
sBuckets Array.<Object>
Properties
Name Type Description
sBucketIndex String The index of the S-bucket
sBucketStats Object
Properties
Name Type Description
used Number Space used in the bucket
free Number Space free in the bucket
Source: