1.0.2 • Published 9 years ago

manta-blob-store v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago