0.5.0 • Published 10 years ago
lbs v0.5.0
local blobstore (lbs)
simple blobstore that leverages the local file system to store blobs. lbs is written in nodejs and leverages sqlite3 for metadata. lbs is meant as a library within your nodejs application, not for individual users.
design
all blobs are stored to the blobs directory of the current working directory, the
sqlite3 index is stored at blobs/.lbs
.
blob keys
keys are based on a sha512 hash of the file contents and uses only the first 32 hexadecimal characters from the hash, this keeps keys short in case they're used in urls.
security
lbs leverages a very simple security mechanism, a random token is generated for each blob that is 8 hexadecimal characters long. the token does not expire, though theoretically could be updated.
api
- init - initializes blob store
- put - store blob onto filesystem returning the actual sqlite3 record
- get - retrieve blob in buffer format, needs to be converted to string
requirements
- node 4.0.0
- npm
installation
npm install lbs
development
git clone git@github.com:stephenhu/lbs
npm install
mocha
usage
var lbs = require("lbs");
lbs.init(function(done) {
});
lbs.put("path/to/file", "appname", function(err, res) {
console.log(res);
lbs.get(res.key, res.application, res.token, function(err, buf) {
console.log(buf);
});
});
outputs
{ id: "",
key: "",
filename: "",
extension: "",
bytes: 0,
token: "",
application: "",
dirty: false,
version: 0,
properties: "",
createdAt: "",
updatedAt: ""
}
// TODO: get sample output from lbs.get