@raabbajam/pluto-storage
v0.0.3
Published
pluto-storage
Readme
pluto-storage
pluto-storage
Install
npm i -S pluto-storageUsage
const plutoStorage = require('pluto-storage');
const {Client, Server} = plutoStorage;
const clientOptions = {
serverUrl: 'localhost:3005',
auth: 's3cret',
downloadDir: '', // default to __dirname/.storage
};
const client = Client(clientOptions);
client.upload(filename) // Promise
.then((url) => console.log(url)) // http://localhost:3006/download/2016/09/26/013f2580-9cc2-48ed-973f-d2be4950e72b
client.uploadPublic(filename); // Promise
client.uploadPublic(readableStream) // Promise
client.download(url, resultFile) // Promise
.then(() => console.log('done downloading'));
client.download($url) // random localpath
.then((localpath) => console.log(localpath));
const serverOptions = {
serverUrl: 'localhost',
port: '2001',
auth: 's3cret',
uploadDir: '', // default to __dirname/.storage
enablePublic: '', // default to false
};
const server = Server(serverOptions);
Server.start() // Promise
.then(() => console.log('listening on port'));
Server.stop() // Promise
.then(() => console.log('stop listening'));License
MIT © Raabb Ajam
