Comparing version 1.0.3 to 1.0.4
@@ -23,3 +23,3 @@ | ||
// Register transport | ||
this.eden.register('asset.transport', new B2Transport()); | ||
this.eden.register('asset.transport.b2', new B2Transport()); | ||
} | ||
@@ -26,0 +26,0 @@ } |
{ | ||
"name": "@edenjs/b2", | ||
"description": "nothing yet", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"dependencies": { | ||
@@ -6,0 +6,0 @@ "backblaze-b2": "^1.3.1" |
@@ -9,1 +9,41 @@ # EdenJS - Backblaze B2 | ||
Backblaze B2 base logic component for [EdenJS](https://github.com/edenjs-cli) | ||
`@edenjs/b2` automatically adds the Backblaze B2 asset transport to your EdenJS installation | ||
## Setup | ||
### Install | ||
``` | ||
npm i --save @edenjs/b2 | ||
``` | ||
### Configure | ||
```js | ||
config.b2 = { | ||
id : '', // backblaze id | ||
secret : '', // backblaze api key | ||
bucket : '', // backblaze bucket name | ||
domain : '', // (optional) cname or other domain that points to this bucket address | ||
}; | ||
``` | ||
#### Example | ||
```js | ||
// require model | ||
const File = model('file'); | ||
// load file | ||
const file = new File(); | ||
// await file creation | ||
await file.fromFile('/local/file/location.pdf'); | ||
// save file | ||
await file.save(); // this is now stored in backblaze | ||
// get url for file | ||
const url = await file.url(); // returns full url to download the file | ||
``` |
7782
48