lib/index.js
function upload(host, accessKey, secretKey, bucket, objectKey, file) {
    var nosHeader = arguments.length <= 6 || arguments[6] === undefined ? {} : arguments[6];

    nosHeader['x-nos-storage-class'] = nosHeader['x-nos-storage-class'] || 'standard';
    var date = utcDate();
    var content = _fs2.default.readFileSync(file);
    var contentLength = content.length;
    var contentMd5 = (0, _md2.default)(content);

    var resource = genResource(bucket, objectKey);
    var canonicalizedHeaders = Object.keys(nosHeader).map(function (key) {
        return key + ':' + nosHeader[key];
    });
    var authorization = authorize(accessKey, secretKey, 'PUT', contentMd5, '', date, canonicalizedHeaders, resource);
    var url = 'http://' + bucket + '.' + host + '/' + objectKey;
    var headers = (0, _lodash.assign)({
        Date: date,
        'Content-Length': contentLength,
        'Content-MD5': contentMd5,
        Authorization: authorization,
        'url': url
    }, nosHeader);
    return nosRequest({ method: 'put', uri: url, body: content, headers: headers });
}
function upload(host, accessKey, secretKey, bucket, objectKey, file) {
    var nosHeader = arguments.length <= 6 || arguments[6] === undefined ? {} : arguments[6];

    nosHeader['x-nos-storage-class'] = nosHeader['x-nos-storage-class'] || 'standard';
    var date = utcDate();
    var content = _fs2.default.readFileSync(file);
    var contentLength = content.length;
    var contentMd5 = (0, _md2.default)(content);

    var resource = genResource(bucket, objectKey);
    var canonicalizedHeaders = Object.keys(nosHeader).map(function (key) {
        return key + ':' + nosHeader[key];
    });
    var authorization = authorize(accessKey, secretKey, 'PUT', contentMd5, '', date, canonicalizedHeaders, resource);
    var url = 'http://' + bucket + '.' + host + '/' + objectKey;
    var headers = (0, _lodash.assign)({
        Date: date,
        'Content-Length': contentLength,
        'Content-MD5': contentMd5,
        Authorization: authorization,
        'url': url
    }, nosHeader);
    return nosRequest({ method: 'put', uri: url, body: content, headers: headers });
}
上传对象
@param {String} accessKey
@param {String} secretKey
@param {String} bucket
@param {String} objectKey
@param {String} file
@param {Object} nosHeader