New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

softlayer-object-storage

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

softlayer-object-storage

Set of helpers to work with the softLayer Object Storage.

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

SoftLayer Object Storage helper

Installing

NPM

$ npm i -S softlayer-object-storage

Code

    import ObjectStorage from 'softlayer-object-storage';
    import fs from 'fs';
    
    const conf = {
      timeout: 1000 * 60 * 10, // connection timeout [optional]
      removeAccess: true, // allow remove objects from container [default false]
      storage: 'public', // public or private
      endpoint: 'https://***.objectstorage.softlayer.net/auth/v1.0',
      username: 'SLOS********-*:***********',
      key: '******************************',
      container: 'backups',
    };
    
    const backupsContainer = new ObjectStorage(conf);
    const readStream = fs.createReadStream('./mysql.sql.gz');

    // create new containers 'test-container'
    backupsContainer.createContainer('test-container')
    .then(console.log)
    .catch(console.error);
    
    // show all containers in your account
    backupsContainer.listContainers()
    .then(console.log)
    .catch(console.error);
    
    // remove container, (you can remove only empty container)
    backupsContainer.removeContainer('test-container')
    .then(console.log)
    .catch(console.error);
    
    // show full url to all files in 'backups' container
    // show full url to all files in folder 'public' of 'backups' container: backupsContainer.listFiles('/public')
    backupsContainer.listFiles()
    .then(console.log)
    .catch(console.error);
    
    // upload 'mysql.sql.gz' from local to OS
    // if you are passing stream from spawn (with no name)
    // 'backupsContainer.uploadFile(readStream, { name: 'custom file name', container, headers: 'object to extent put headers' })'
    // or you can even just pass the path 'backupsContainer.uploadFile('./mysql.sql.gz')'
    backupsContainer.uploadFile(readStream)
    .then(console.log)
    .catch(console.error);
    
    // remove 'mysql.sql.gz' from OS
    // you can pass string (to remove one object) or array of string to remove many
    // string is a a name or full URL to object
    backupsContainer.removeFile('mysql.sql.gz') // or backupsContainer.removeFile('https://***.objectstorage.softlayer.net/v1/AUTH_**/backups/mysql.sql.gz')
    .then(console.log)
    .catch(console.error);

License

MIT

Keywords

softlayer

FAQs

Package last updated on 26 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts