node-ali-oss

0.0.2 • Public • Published

node-ali-oss

安装

npm install node-ali-oss

使用

构造对象

var OSS = require('node-ali-oss');
var options = {
  bucket: 'node-ali-oss',
  accessKeyId: 'iAeyzYXtZAdM8V2V',
  accessKeySecret: 'AmieMAD5ZYuevL3UNrkeORzQ0cvqrO'
}
var client = OSS(options);

options:

  • accessKeyId
  • accessKeySecret

update

client.upload(file, name, cb)

options:

  • file: can be filepath, fileContent, stream
  • name: object name in oss

get

client.get(name, cb)

options:

  • name: object name in oss

remove

client.remove(name, cb)

例子

path = require 'path'
fs = require 'fs'
OSS = require 'node-ali-oss'
 
 
 
options = 
  bucket: 'node-ali-oss',
  accessKeyId: 'iAeyzYXtZAdM8V2V',
  accessKeySecret: 'AmieMAD5ZYuevL3UNrkeORzQ0cvqrO'
 
client = OSS options
 
 
file = path.join __dirname'../package.json'
ossFilename = 'node-ali-oss-package.json'
 
 
client.upload fileossFilename(err, info)->
  return console.log err if err
  client.get ossFilename(err, info)->
    return console.log err if err
    console.log info.toString()
    client.remove ossFilename(err, info)->
      console.log errinfo
 

Package Sidebar

Install

npm i node-ali-oss

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • jifeng.zjd