Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 981 Bytes

File metadata and controls

53 lines (34 loc) · 981 Bytes

node-ovh-storage

A simple Node.js library to connect to the Object Storage OVH service.

Install via npm

npm install node-ovh-storage

API Usage

const OVHStorage  = require('node-ovh-storage');

const config      = {
  authURL:    'https://auth.cloud.ovh.net/v3',
  username:   'username',
  password:   'password',
  tenantId:   'tenantId',
  region:     'GRA'
};

// test function
const test = async () => {

  const storage = new OVHStorage(config);

  // init token (optional)
  await storage.getToken();

  // create new container
  await storage.createContainer('Container-1');

  // put file
  await storage.putFile('./tmp/doc.pdf', '/Container-1/doc.pdf');

  // list files in container
  await storage.getFileList('/Container-1');

  // get file
  await storage.getFile('/Container-1/doc.pdf');

  // delete file
  await storage.deleteFile('/Container-1/doc.pdf');

};

test();