Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ali-oss

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ali-oss

aliyun oss(open storage service) node client

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
56K
increased by38.41%
Maintainers
1
Weekly downloads
 
Created
Source

ali-oss

travis-ci

aliyun OSS(open storage service) node client. generator friendly.

a node.js wrapper for OSS restful api

Install

npm install ali-oss

Usage

Init

init a oss client, need accessKeyId, accessKeySecret and bucket

var OSS = require('ali-oss');
var client = OSS.create({
  accessKeyId: 'id',
  accessKeySecret: 'xxx',
  bucket: 'test'
});

options:

  • accessKeyId
  • accessKeySecret
  • [host]: default to oss.aliyuncs.com:8080
  • [timeout]: default to '10s'

Methods

upload, put
yield* client.upload(file, name, options);

options:

  • file: can be filepath, fileContent, stream
  • name: object name in oss
  • options:
    • timeout: request timeout
    • headers: custom headers, checkout the doc
    • mime: file mime type, will send to mime.lookup
download, get
yield* client.get(name, path, options);

options:

  • name: object name in oss
  • path: can be filepath and stream
  • options:
    • timeout
    • headers
remove, delete
yield* client.remove(name, options);

options:

  • name: object name in oss
  • options:
    • timeout

no generator support

if you do not use node v0.11+ or do not use node --harmony. this module will use regenerator to convert to es5 style. so you only need to use co wrap the generator function into callback style:

var co = require('co');
var OSS = require('ali-oss');
var client = OSS.create({});

client.update = co(client.update);
client.get = co(client.get);
client.remove = co(client.remove);

then you use these APIs as common async callback APIs. checkout the callback_example.js.

License

MIT

Keywords

FAQs

Package last updated on 11 Apr 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc