https://github.com/mattchewone/b2-blob-store
backblaze b2 blob store
https://github.com/mattchewone/b2-blob-store
abstract-blob-store backblaze-b2 featherjs
Last synced: 8 months ago
JSON representation
backblaze b2 blob store
- Host: GitHub
- URL: https://github.com/mattchewone/b2-blob-store
- Owner: Mattchewone
- License: mit
- Created: 2017-07-11T19:11:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-20T15:57:52.000Z (almost 9 years ago)
- Last Synced: 2025-03-16T17:46:42.371Z (over 1 year ago)
- Topics: abstract-blob-store, backblaze-b2, featherjs
- Language: JavaScript
- Size: 11.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# b2-blob-store
Backblaze B2 blob store implementation.
This is not currently working and is a WIP, this is not published to NPM.
[](https://github.com/maxogden/abstract-blob-store)
## Example
```js
const b2Blob = require('../');
const request = require('request').defaults({ json: true });
const fs = require('fs');
const url = 'https://api.backblaze.com/b2api/v1/b2_authorize_account';
const base64 = new Buffer(process.env.accountId + ':' + process.env.applicationKey).toString('base64');
const headers = {
Authorization: 'Basic ' + base64
};
// Authorise the account
request({ url, headers }, (err, resp, body) => {
let store = new b2Blob({
token: body.authorizationToken,
baseDownloadURL: body.downloadUrl,
apiUrl: body.apiUrl,
bucket: process.env.bucketId
});
fs.createReadStream('./test.txt')
.pipe(store.createWriteStream({ key: 'test.txt' }, (err, meta) => {
console.log('err', err);
console.log('meta', meta);
}))
.pipe(process.stdout)
.on('error', function (e) {
console.error('error', e);
});
});
```
## TBD
- [ ] Get file size from the stream so we can add to `Content-Length`
- [ ] SHA1 the file data so we can verify the data upload