new Sbucket(dbPath [, options])
Parameters:
| Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dbPath |
String | The path to database on disk | ||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Options to pass through to leveldown#open
Properties
|
- Source:
Methods
-
close(callback)
-
Closes the underlying database
Parameters:
Name Type Description callbackSbucket~closeCallback - Source:
Fires:
-
createReadStream(key)
-
Returns a readable stream of the file at the given key
Parameters:
Name Type Description keyString The key for the file to read - Source:
Returns:
- Type
- ReadableFileStream
-
createWriteStream(key)
-
Returns a writable stream for a file at the given key
Parameters:
Name Type Description keyString The key for the file to read - Source:
Returns:
- Type
- WritableFileStream
-
exists(key, callback)
-
Determines if the file is already stored in the db
Parameters:
Name Type Description keyString The key for the file stored callbackSbucket~existsCallback - Source:
-
flush(callback)
-
Trigger a compaction for the S-bucket
Parameters:
Name Type Description callbackSbucket~flushCallback - Source:
-
list(callback)
-
Get a list of file keys in the bucket and their approximate size
Parameters:
Name Type Description callbackSbucket~listCallback - Source:
-
open(callback)
-
Opens the underlying database
Parameters:
Name Type Description callbackSbucket~openCallback - Source:
Fires:
-
readFile(key, callback)
-
Reads the file at the given key into a buffer
Parameters:
Name Type Description keyString The key for the file to read callbackSbucket~readFileCallback - Source:
-
stat(callback)
-
Get stats for this bucket
Parameters:
Name Type Description callbackSbucket~statCallback - Source:
-
unlink(key, callback)
-
Deletes the file chunks from the database
Parameters:
Name Type Description keyString The key for the file stored callbackSbucket~unlinkCallback - Source:
-
writeFile(key, buffer, callback)
-
Writes the buffer to the given key
Parameters:
Name Type Description keyString The key for the file to write bufferBuffer The data to write to the given key callbackSbucket~writeFileCallback - Source:
Type Definitions
-
closeCallback( [error])
-
Parameters:
Name Type Argument Description errorError <optional>
- Source:
-
existsCallback( [error], fileDoesExist)
-
Parameters:
Name Type Argument Description errorError <optional>
fileDoesExistBoolean - Source:
-
flushCallback(error)
-
Parameters:
Name Type Description errorError | null - Source:
-
listCallback( [error], results)
-
Parameters:
Name Type Argument Description errorError <optional>
resultsArray.<Object> Properties
Name Type Description baseKeyString approximateSizeNumber - Source:
-
openCallback( [error])
-
Parameters:
Name Type Argument Description errorError <optional>
- Source:
-
readFileCallback( [error], fileBuffer)
-
Parameters:
Name Type Argument Description errorError <optional>
fileBufferBuffer - Source:
-
statCallback( [error], bucketStats)
-
Parameters:
Name Type Argument Description errorError <optional>
bucketStatsObject Properties
Name Type Description sizeNumber The used space in bytes freeNumber The free space left in bytes - Source:
-
unlinkCallback( [error])
-
Parameters:
Name Type Argument Description errorError <optional>
- Source:
-
writeFileCallback( [error])
-
Parameters:
Name Type Argument Description errorError <optional>
- Source:
Events
-
close
-
Triggered when the underlying database closes
- Source:
-
idle
-
Triggered when there are no more pending operations
- Source:
-
locked
-
Triggered when the bucket is locked for flushing
- Source:
-
open
-
Triggered when the underlying database opens
- Source:
-
unlocked
-
Triggered when the bucket is unlocked
- Source: