SoftLayer Object Storage helper
Installing
NPM
$ npm i -S softlayer-object-storage
Code
; ; 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 = conf; const readStream = fs; // create new containers 'test-container' backupsContainer ; // show all containers in your account backupsContainer ; // remove container, (you can remove only empty container) backupsContainer ; // 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 ; // 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 ; // 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 // or backupsContainer.removeFile('https://***.objectstorage.softlayer.net/v1/AUTH_**/backups/mysql.sql.gz') ;
License
MIT