https://github.com/131/node-ovh
https://github.com/131/node-ovh
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/131/node-ovh
- Owner: 131
- License: other
- Created: 2017-10-15T22:00:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-17T10:54:04.000Z (over 1 year ago)
- Last Synced: 2025-10-03T01:14:20.093Z (9 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is an es7 async/await openstack swift client API.
[](https://www.npmjs.org/package/ovh-es)
[](http://travis-ci.org/131/node-ovh)
[](https://coveralls.io/r/131/node-ovh?branch=master)
```js
// 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
```bash
$ 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;
```