manta-blob-store

1.0.2 • Public • Published

Codeship Status for areo/areo

blob-store-compatible

manta-blob-store

blob store that stores blobs in manta

npm install manta-blob-store

Usage

var fs = require('fs'),
    manta = require('manta'),
    path = require('path'),
    MantaBlobStore = require('./');
 
//Create a manta client with credentials from your environment variables as described here:
// https://apidocs.joyent.com/manta/nodesdk.html#creating-a-client
var client = manta.createClient({
    sign: manta.privateKeySigner({
        key: fs.readFileSync(process.env.HOME + '/.ssh/id_rsa', 'utf8'),
        keyId: process.env.MANTA_KEY_ID,
        user: process.env.MANTA_USER
    }),
    user: process.env.MANTA_USER,
    url: process.env.MANTA_URL
});
 
//create a manta-blob-store with the client as a parameter
var store = new MantaBlobStore({
    client: client
});
 
//create a write stream on the store
var ws = store.createWriteStream({
    key: 'file.txt'
}, function() {
 
    //Create a read stream from the store
    var rs = store.createReadStream({
        key: 'file.txt'
    })
 
    //pipe the stream from manta to stdout
    rs.pipe(process.stdout)
});
 
//Pipe some text to the write stream
ws.end('hello world\n');
 

License

MIT

Package Sidebar

Install

npm i manta-blob-store

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • klokoy