lib/index.js
function getMeta(host, accessKey, secretKey, bucket, objectKey) {
    var expires = arguments.length <= 5 || arguments[5] === undefined ? 0 : arguments[5];
    var opts = arguments.length <= 6 || arguments[6] === undefined ? {} : arguments[6];

    var date = utcDate();
    if (opts.versionId) url += '?versionId=' + opts.versionId;
    var resource = genResource(bucket, objectKey, (0, _lodash.pick)(opts, ['versionId']));
    var authorization = authorize(accessKey, secretKey, 'HEAD', '', '', date, [], resource);
    var signature = (0, _urlencode2.default)(generateSignature(secretKey, 'HEAD', '', '', date, [], resource));
    var url = pub ? 'http://' + bucket + '.' + host + '/' + objectKey : 'http://' + host + '/' + bucket + '/' + objectKey + '?NOSAccessKeyId=' + accessKey + '&Expires=' + expires + '&Signature=' + signature;

    var headers = { Date: date };
    if (opts.modifiedSince) headers['If-Modified-Since'] = opts.modifiedSince;
    headers['url'] = url;

    return nosRequest({ method: 'head', uri: url, headers: headers }).then(function (res) {
        var contentType = res['content-type'];
        var lastModified = res['last-modified'];
        var etag = res['etag'];
        var requestId = res['x-nos-request-id'];
        return { contentType: contentType, lastModified: lastModified, etag: etag, requestId: requestId };
    });
}
function getMeta(host, accessKey, secretKey, bucket, objectKey) {
    var expires = arguments.length <= 5 || arguments[5] === undefined ? 0 : arguments[5];
    var opts = arguments.length <= 6 || arguments[6] === undefined ? {} : arguments[6];

    var date = utcDate();
    if (opts.versionId) url += '?versionId=' + opts.versionId;
    var resource = genResource(bucket, objectKey, (0, _lodash.pick)(opts, ['versionId']));
    var authorization = authorize(accessKey, secretKey, 'HEAD', '', '', date, [], resource);
    var signature = (0, _urlencode2.default)(generateSignature(secretKey, 'HEAD', '', '', date, [], resource));
    var url = pub ? 'http://' + bucket + '.' + host + '/' + objectKey : 'http://' + host + '/' + bucket + '/' + objectKey + '?NOSAccessKeyId=' + accessKey + '&Expires=' + expires + '&Signature=' + signature;

    var headers = { Date: date };
    if (opts.modifiedSince) headers['If-Modified-Since'] = opts.modifiedSince;
    headers['url'] = url;

    return nosRequest({ method: 'head', uri: url, headers: headers }).then(function (res) {
        var contentType = res['content-type'];
        var lastModified = res['last-modified'];
        var etag = res['etag'];
        var requestId = res['x-nos-request-id'];
        return { contentType: contentType, lastModified: lastModified, etag: etag, requestId: requestId };
    });
}
function getMeta ( host , accessKey , secretKey , bucket , objectKey ) { var expires = arguments . length <= 5 || arguments [ 5 ] === undefined ? 0 : arguments [ 5 ] ; var opts = arguments . length <= 6 || arguments [ 6 ] === undefined ? { } : arguments [ 6 ] ; var date = utcDate ( ) ; if ( opts . versionId ) url += '?versionId=' + opts . versionId ; var resource = genResource ( bucket , objectKey , ( 0 , _lodash . pick ) ( opts , [ 'versionId' ] ) ) ; var authorization = authorize ( accessKey , secretKey , 'HEAD' , '' , '' , date , [ ] , resource ) ; var signature = ( 0 , _urlencode2 . default ) ( generateSignature ( secretKey , 'HEAD' , '' , '' , date , [ ] , resource ) ) ; var url = pub ? 'http://' + bucket + '.' + host + '/' + objectKey : 'http://' + host + '/' + bucket + '/' + objectKey + '?NOSAccessKeyId=' + accessKey + '&Expires=' + expires + '&Signature=' + signature ; var headers = { Date : date } ; if ( opts . modifiedSince ) headers [ 'If-Modified-Since' ] = opts . modifiedSince ; headers [ 'url' ] = url ; return nosRequest ( { method : 'head' , uri : url , headers : headers } ) . then ( function ( res ) { var contentType = res [ 'content-type' ] ; var lastModified = res [ 'last-modified' ] ; var etag = res [ 'etag' ] ; var requestId = res [ 'x-nos-request-id' ] ; return { contentType : contentType , lastModified : lastModified , etag : etag , requestId : requestId } ; } ) ; }
获取对象相关元数据信息
@param {String} accessKey
@param {String} secretKey
@param {String} bucket
@param {String} objectKey
@param {Object} [opts]
@param {String} [opts.modifiedSince]
@returns {Promise}
获取对象相关元数据信息