Wondering what’s next for npm?Check out our public roadmap! »

digitalocean-spaces

0.0.1 • Public • Published

digitalocean-spaces

Read and write objects to DigitalOcean Spaces using fetch()

Install

$ npm install digitalocean-spaces

Usage

var Spaces = require('digitalocean-spaces')
global.fetch = require('node-fetch')
 
var spaces = new Spaces({
    accessKey: '<private accessKey>',
    secretKey: '<private secretKey>',
    region: 'nyc3'
});
 
(async function() {
    try {
 
        let bucket = 'testbucket';
        let key = '/a/test/file.txt';
        let body = 'test file contents';
 
        let putResponse = await spaces.putObject({bucket, key, body})
 
        console.log(`put status: ${putResponse.status}`)
        console.log(`put response body: '${await putResponse.text()}'`)
 
        let getResponse = await spaces.getObject({bucket, key});
 
        console.log(`get status: ${getResponse.status}`)
        console.log(`get response body: '${await getResponse.text()}'`)
 
        let delResponse = await spaces.deleteObject({bucket, key});
 
        console.log(`del status: ${delResponse.status}`)
        console.log(`del response body: '${await delResponse.text()}'`)
    }
    catch (ex) {
        console.log(ex)
    }
}());

License

MIT license; see LICENSE.

Install

npm i digitalocean-spaces

DownloadsWeekly Downloads

53

Version

0.0.1

License

MIT

Unpacked Size

3.19 kB

Total Files

4

Last publish

Collaborators

  • avatar