fs-blob-store
Advanced tools
Comparing version 4.0.0 to 4.0.1
10
index.js
@@ -21,3 +21,3 @@ var fs = require('fs') | ||
this.key = null | ||
this.length = 0 | ||
this.size = 0 | ||
this.destroyed = false | ||
@@ -75,3 +75,3 @@ | ||
if (data === SIGNAL_FLUSH) return this._flush(cb) | ||
this.length += data.length | ||
this.size += data.length | ||
this._digest.update(data) | ||
@@ -117,4 +117,6 @@ this._ws.write(data, enc, cb) | ||
if (err) return cb(err) | ||
ws.size = ws.length | ||
cb(null, ws) | ||
cb(null, { | ||
key: ws.key, | ||
size: ws.size | ||
}) | ||
}) | ||
@@ -121,0 +123,0 @@ |
{ | ||
"name": "fs-blob-store", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Streamable content addressable blob object store that is streams2 and implements the blob store interface on top of the fs module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -26,3 +26,3 @@ # fs-blob-store | ||
w.end(function() { | ||
console.log('blob written: '+w.hash) | ||
console.log('blob written: '+w.key) | ||
store.createReadStream(w).pipe(process.stdout) | ||
@@ -38,11 +38,11 @@ }) | ||
You can also specify a node `crytpo` module hashing algorithm to use using the `algo` key in options. The default is `sha256`. | ||
You can also specify a node `crypto` module hashing algorithm to use using the `algo` key in options. The default is `sha256`. | ||
#### `var readStream = store.createReadStream(opts)` | ||
Open a read stream to a blob. `opts` must have a `hash` key with the hash of the blob you want to read. | ||
Open a read stream to a blob. `opts` must have a `key` key with the hash of the blob you want to read. | ||
#### `var writeStream = store.createWriteStream([cb])` | ||
Add a new blob to the store. Use `writeStream.hash` to get the hash after the `finish` event has fired | ||
Add a new blob to the store. Use `writeStream.key` to get the hash after the `finish` event has fired | ||
or add a callback which will be called with `callback(err, metadata)`. | ||
@@ -52,7 +52,7 @@ | ||
Check if an blob exists in the blob store. `metadata` must have a `hash` property. Callback is called with `callback(err, exists)` | ||
Check if an blob exists in the blob store. `metadata` must have a `key` property. Callback is called with `callback(err, exists)` | ||
#### `store.remove(metadata, [cb])` | ||
Remove a blob from the store. `metadata` must have a `hash` property. Callback is called with `callback(err, wasDeleted)` | ||
Remove a blob from the store. `metadata` must have a `key` property. Callback is called with `callback(err, wasDeleted)` | ||
@@ -59,0 +59,0 @@ ## License |
7646
163