ovh-es
v1.7.0
Published
ES7 Node.js wrapper for the OVH APIs
Downloads
27
Readme
This is an es7 async/await openstack swift client API.
// Create your first application tokens here: https://api.ovh.com/createToken/?GET=/me
var ovh = require('ovh-es')({
appKey: process.env.APP_KEY,
appSecret: process.env.APP_SECRET,
consumerKey: process.env.CONSUMER_KEY
});
var me = await ovh.request('GET', '/me');
console.log(err || 'Welcome ' + me.firstname);
Installation
$ npm install ovh-es
Services (wrapper)
object-store
"use strict";
const fs = require('fs');
const Context = require('ovh-es/context');
const storage = require('ovh-es/services/object-store');
const pipe = require('nyks/stream/pipe');
const config = require('./credentials');
class foo {
async run(){
// init token
var ctx = await Context.build(config);
var files = await storage.toggleMode(ctx, 'mediaprivate', ".r:*,.rlistings");
var headers = await storage.showContainer(ctx, 'mediaprivate');
var remote = await storage.putFile(ctx, 'boucs.jpg', 'mediaprivate/bouc.jpg');
var local = fs.createWriteStream('tmp.jpg');
var remote = storage.download(ctx, 'mediaprivate/bouc.jpg');
await pipe(remote, local);
var remote = await storage.deleteFile(ctx, 'mediaprivate/bouc.jpg');
var files = await storage.getFileList(ctx, 'mediaprivate');
console.log({files, remote});
}
}
module.exports = foo;