0.3.6 • Published 8 years ago

oss-easy v0.3.6

Weekly downloads
4
License
-
Repository
github
Last release
8 years ago

oss-easy

an aliyun oss service client for nodejs, exposes api more like the file system module of Node.JS 一个阿里云 OSS 服务的 Node.JS 模块,提供类似 fs 的 API。同时提供一些方便的批量操作方法

Documentation

Init bucekt client instance

OssEasy = require("oss-easy")
ossOptions = {
  accessKeyId : "your oss key"
  accessKeySecret : "your oss secret"
}
var oss = new OssEasy(ossOptions, "bucket_name");

Write data to bucket

oss.writeFile('remote/path/to/filename', 'content could be string of buffer', function(err) {
    if(err) console.log(err);
});

Upload a local file to bucket

oss.uploadFile('path_to_local_file', 'remote/path/to/filename', function(err) {
    if(err) console.log(err);
});

Upload multiple local files to bucket in one batch

var tasks = {
  'local/path/to/filename0': "remote/path/to/filename0",
  'local/path/to/filename1': "remote/path/to/filename1",
  'local/path/to/filename2': "remote/path/to/filename2",
};
oss.uploadFiles(tasks, function(err) {
    if(err) console.log(err);
});

Download a file from bucket

oss.downloadFile('remote/path/to/filename', 'path_to_local_file', 'function(err) {
    if(err) console.log(err);
});

Download multiple files from bucket

var tasks = {
  "remote/path/to/filename0": 'local/path/to/filename0',
  "remote/path/to/filename1": 'local/path/to/filename1',
  "remote/path/to/filename2": 'local/path/to/filename2',
};

oss.downloadFiles(tasks, function(err) {
    if(err) console.log(err);
});

Delete a file from the bucekt

oss.deleteFile(filename, function(err) {
    if(err) console.log(err);
});

Delete all remote files under a given folder path

oss.deleteFolder('remote/path/to/folder', function(err) {
    if(err) console.log(err);
})

Delete multiple remote files from bucket in one batch

oss.deleteFiles(['remote/path/to/filename0','remote/path/to/filename1'], function(err) {
    if(err) console.log(err);
});

Test

mocha tests

License

Copyright (c) 2013 yi Licensed under the MIT license.

0.3.6

8 years ago

0.3.5

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.9

9 years ago

0.2.8

9 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.1.9

10 years ago

0.1.8

11 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago