1.5.1 • Published 6 years ago

huawei-obs v1.5.1

Weekly downloads
25
License
MIT
Repository
-
Last release
6 years ago

huawei-obs

huawei OBS(Object Storage Service) client for nodeJS

Installation

$ npm install huawei-obs --save

Node.js >= 8.0.0 required.

Features

  • ✔︎ put object from local to huawei obs online
  • ✔︎ download object from huawei obs online.

Doc

putObject(name, filePath, callback, processCallback)

upload object

more detail:https://support.huaweicloud.com/api-obs/zh-cn_topic_0100846775.html

@param {String} name - the name display in obs 
@param {String} filePath - upload file path
@param {Function} callback - callback when file uploaded 
@param {Function} processCallback - upload process callback, include processCallback(chunk, hasUploadPercent)
@param {String} bucketName - bucket name

getObject(name, storagePathOrWriteStream, callback, processCallback, isOverwrite=false, range)

download object

more detail:https://support.huaweicloud.com/api-obs/zh-cn_topic_0100846779.html

@param {String} name - the name in obs
@param {String} storagePathOrWriteStream - save file path or writeStream
@param {Function} callback - callback when file has been download
@param {Function} processCallback - upload process callback, include processCallback(chunk, hasUploadPercent)
@param {Boolean} isOverwrite - if local file exist , is overwrite ? default: false
@param {String} bucketName - bucket name

headObject(name, callback, bucketName)

get object information.

more detail:https://support.huaweicloud.com/api-obs/zh-cn_topic_0100846780.html

@param {String} name - the name in obs
@param {Function} callback - callback
@param {String} bucketName - bucket name

deleteObject(name, callback, bucketName)

delete object information.

more detail:https://support.huaweicloud.com/api-obs/zh-cn_topic_0100846782.html

@param {String} name - the name in obs
@param {Function} callback - callback when file deleted
@param {String} bucketName - bucket name

Example

const OBS = require('huawei-obs');

const client = new OBS({
  accessKey: 'access key',
  secretAccessKey: 'secret access key',
  endpoint: 'end point',
  bucketName: 'bucket name'
});

client.putObject(name, filePath, (err, info) => {
    .....
});

client.getObject(name, localPath, (err, info) => {
    .....
});

License

MIT

1.5.1

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.6

6 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.1.1

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago