ovh-iconlib-provider-storage

0.3.0 • Public • Published

Icon Library - Storage Provider

Build Status Coverage Status

NPM

Storage Provider used to define a contract for all storage process in the Icon Library project.

StorageBaseProvider

Methods to implement

  • abstract class StorageBaseProvider
    • abstract function list(string path, number skip, number take)
    • abstract function upload(Stream stream, Object options)
    • abstract function download(string filepath)
    • abstract function remove(string filepath)

Implementations

  • oss (ovh-iconlib-provider-storage-oss)

License

See LICENSE file


OSS example

Installation

npm install --save ovh-iconlib-provider-storage ovh-iconlib-provider-storage-oss

Configuration

# config.yml 
---
connections:
    -
        name: test
        authUrl: ${OSS_AUTH_URL}
        username: ${OSS_USERNAME}
        password: ${OSS_PASSWORD}
        region: ${OSS_REGION}
        container: ${OSS_CONTAINER}
storage:
   default: oss
   providers:
     -
       name: oss
       type: ovh-iconlib-provider-storage-oss
       connection: test

Usage

// default provider instance loaded according to the configuration
const storage = require('ovh-iconlib-provider-storage').getInstance(); 
// get files
storage.list()
    .then(files => {
        files.forEach(file =>  {
            ...
        });
    });
// upload file
let stream = ...;
storage.upload(stream, {name: 'example.txt'})
    .then(fileInfo => {
        ...
    });
// remove file
storage.remove('example.txt')
    .then(removed => {
        ...
    });

Readme

Keywords

Package Sidebar

Install

npm i ovh-iconlib-provider-storage

Weekly Downloads

3

Version

0.3.0

License

BSD-3-Clause

Last publish

Collaborators

  • marie-j
  • jisay
  • axelpeter
  • blary_jp
  • antleblanc
  • cbourgois
  • ovh-ux-cds
  • lizardk
  • ovh
  • gioindahouz
  • jleveugle
  • bnjjj
  • khuang