GithubHelp home page GithubHelp logo

ali-oss's Introduction

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

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

get

yield* client.get(name, path, options);

options:

  • name: object name in oss
  • path: can be filepath and stream
  • options:
    • timeout
    • headers

remove

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

ali-oss's People

Contributors

dead-horse avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.