1.0.1 • Published 7 years ago

xx-oss-service v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

xx-oss-service NPM version

Aliyun OSS service for our team

该库是对ali-oss的封装。

安装

$ yarn add xx-oss-service

示例

const Bucket = require('xx-oss-service');
const bucket = new Bucket({
	accessKeyId: 'MyAccessKeyId',
	accessKeySecret: 'MyAccessKeySecret',
	bucket: 'MyBucket'
});

API

  • consturctor(options) - options - accessKeyId - accessKeySecret - bucket
  • *listObjects(query, options) => {objects, nextMarker} 获取object列表,参数参照ali-oss#list
  • *putObjectMeta(object, meta, options) => null 设置object的meta,参数参照ali-oss#putMeta
  • *getObjectMeta => meta 获取object的meta,参数参照ali-oss#head
  • *putObjectWithUUID(prefix, path, options) => {name, url} 上传一个文件,随机生成文件名,上传成功后删除本地文件。 - prefix: object的前缀,即对象需要上传的文件目录 - path: 需要上传的文件在本地的路径 - options: 参照ali-oss#put
  • *putObject(obj, path, options) => {name, url} 上传一个文件,上传成功后删除本地文件 - obj: object的名称 - path: 需要上传的文件在本地的路径 - options: 参照ali-oss#put
  • *putObjectWithRawData(obj, data, options) => {name, url} 上传一段数据 - obj: object的名称 - data: 需要上传的数据 - options: 参照ali-oss#put
  • *deleteObject(object, options) => null 删除一个object,参数参照ali-oss#delete
  • *deleteObjects(objects, options) => null 删除一组objects,参数参照ali-oss#deleteMulti
  • *getObjectUrl(object, baseUrl) => url 通过object名称获取url地址,参数参照ali-oss#getObjectUrl
  • *getSignedUrl(object,options) => url 通过object名称获取带签名参数的url地址,参数参考ali-oss#signatureUrl

Contributing

  • Fork this Repo first
  • Clone your Repo
  • Install dependencies by $ npm install
  • Checkout a feature branch
  • Feel free to add your features
  • Make sure your features are fully tested
  • Publish your local branch, Open a pull request
  • Enjoy hacking <3

MIT license

Copyright (c) 2017 Misery Lee <miserylee@foxmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


built upon love by docor v0.3.0