npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aliyun-oss-node

v0.6.1

Published

aliyun oss client for node.js

Downloads

12

Readme

NPM version License Dependency status

oss-client

a node.js module to connect aliyun oss, friendly with co, koa ...

npm install oss-client

aliyun oss document

how to use

var OSS = require('oss-client');
var option = {
  accessKeyId: 'access key id',
  accessKeySecret: 'access key secret'
};

/*
 * host - default: oss.aliyuncs.com
 * port - default: 8080
 * timeout - default: 30000000
 * agent - default: agent.maxSockets = 20
 */

var oss = OSS.create(option);

参数说明:

{
  bucket: 'bucket name',
  object: 'object name',
  acl: 'bucket 访问规则'
}

object

创建object(by: file path)

/*
 * srcFile: 上传的文件路径
 * userMetas: 可选,object类型,用户自定义header,如: x-oss-meta-location
 */
putObject({
  bucket: bucket,
  object: object,
  srcFile: srcFile,
  userMetas: userMetas //optional
}, function (err) {});

创建object(by: buffer)

/*
 * userMetas: 可选,object类型,用户自定义header,如: x-oss-meta-location
 * contentType: 可选,但推荐添加(buffer无法自动获取contentType)
 */

oss.putObject({
  bucket: bucket,
  object: object,
  srcFile: new Buffer("hello,wolrd", "utf8"),
  contentType: 'image/jpeg'
}, function (error, result) {});

创建object(by: stream)

/*
 * userMetas: 可选,object类型,用户自定义header,如: x-oss-meta-location
 */
var input = fs.createReadStream(__filename);
oss.putObject({
  bucket: bucket,
  object: object,
  srcFile: input,
  contentLength: fs.statSync(__filename).size
}, function (error, result) {});

复制object

copyObject({
  bucket: bucket,
  object: object,
  srcObject: srcObject
}, function (err) {});

删除object

deleteObject({
  bucket: bucket,
  object: object
}, function (err) {});

获取object

/*
 * dstFile: 保存object的文件路径
 * userHeaders: 可选,object类型,用户自定义header,如 If-Unmodified-Since
 */
getObject({
  bucket: bucket,
  object: object,
  dstFile: dstFile,
  userHeaders: userHeaders
}, function (err) {});

获取object头信息

headObject({
  bucket: bucket,
  object: object
}, function (err, result) {});

获取object列表

/*
 * prefix: 可选,object 前缀
 * marker: 可选,列表起始object
 * delimiter: 可选,object分组字符,若为 '/' 则不列出路径深度大于等于二层的object
 * maxKeys: 可选, 列出的object最大个数
 */
listObject({
  bucket: bucket,
  prefix: prefix,
  marker: marker,
  delimiter: delimiter,
  maxKeys: maxKeys
}, function (err, result) {});

bucket

列出所有bucket

listBucket(function (err) {});

创建bucket

createBucket({
  bucket: bucket,
  acl: acl
}, function (err) {});

删除bucket

deleteBucket(bucket, function (err) {});

获取bucket访问规则

getBucketAcl(bucket, function (err, result) {});

设置bucket访问规则

setBucketAcl({
  bucket: bucket,
  acl: acl
}, function (err) {});

use with co or koa

var option = {
  wrapper: 'thunk', // or: promise
  accessKeyId: '',
  accessKeySecret: ''
};

var oss = OSS.create(option);

// in co or koa
yield oss.listBucket();

Coverage

97%

License

MIT