@@ -142,6 +142,7 @@ All operation use es7 async/await to implement. All api is async function.
142142 - [ .putMeta(name, meta[ , options] )] ( #putmetaname-meta-options )
143143 - [ .deleteMulti(names[ , options] )] ( #deletemultinames-options )
144144 - [ .signatureUrl(name[ , options] )] ( #signatureurlname-options )
145+ - [ .asyncSignatureUrl(name[ , options] )] ( #signatureurlname-options )
145146 - [ .putACL(name, acl[ , options] )] ( #putaclname-acl-options )
146147 - [ .getACL(name[ , options] )] ( #getaclname-options )
147148 - [ .restore(name[ , options] )] ( #restorename-options )
@@ -2636,6 +2637,83 @@ const url = store.signatureUrl('ossdemo.png', {
26362637console.log(url);
26372638```
26382639
2640+ ### .asyncSignatureUrl(name[, options])
2641+
2642+ Basically the same as signatureUrl, if refreshSTSToken is configured asyncSignatureUrl will refresh stsToken
2643+
2644+ parameters:
2645+
2646+ - name {String} object name store on OSS
2647+ - [options] {Object} optional parameters
2648+ - [expires] {Number} after expires seconds, the url will become invalid, default is `1800`
2649+ - [method] {String} the HTTP method, default is 'GET'
2650+ - [Content-Type] {String} set the request content type
2651+ - [process] {String} image process params, will send with `x-oss-process`
2652+ e.g.: `{process: 'image/resize,w_200'}`
2653+ - [trafficLimit] {Number} traffic limit, range: `819200`~`838860800`.
2654+ - [subResource] {Object} additional signature parameters in url.
2655+ - [response] {Object} set the response headers for download
2656+ - [content-type] {String} set the response content type
2657+ - [content-disposition] {String} set the response content disposition
2658+ - [cache-control] {String} set the response cache control
2659+ - See more: <https://help.aliyun.com/document_detail/31980.html>
2660+ - [callback] {Object} set the callback for the operation
2661+ - url {String} set the url for callback
2662+ - [host] {String} set the host for callback
2663+ - body {String} set the body for callback
2664+ - [contentType] {String} set the type for body
2665+ - [customValue] {Object} set the custom value for callback,eg. {var1: value1,var2:value2}
2666+
2667+ Success will return signature url.
2668+
2669+ example:
2670+
2671+ - Get signature url for object
2672+
2673+ ```js
2674+ const url = await store.asyncSignatureUrl('ossdemo.txt');
2675+ console.log(url);
2676+ // --------------------------------------------------
2677+ const url = await store.asyncSignatureUrl('ossdemo.txt', {
2678+ expires: 3600,
2679+ method: 'PUT'
2680+ });
2681+ console.log(url);
2682+ // put object with signatureUrl
2683+ // -------------------------------------------------
2684+ const url = await store.asyncSignatureUrl('ossdemo.txt', {
2685+ expires: 3600,
2686+ method: 'PUT',
2687+ 'Content-Type': 'text/plain; charset=UTF-8',
2688+ });
2689+ console.log(url);
2690+ // --------------------------------------------------
2691+ const url = await store.asyncSignatureUrl('ossdemo.txt', {
2692+ expires: 3600,
2693+ response: {
2694+ 'content-type': 'text/custom',
2695+ 'content-disposition': 'attachment'
2696+ }
2697+ });
2698+ console.log(url);
2699+ // put operation
2700+ ```
2701+
2702+ - Get a signature url for a processed image
2703+
2704+ ```js
2705+ const url = await store.asyncSignatureUrl('ossdemo.png', {
2706+ process: 'image/resize,w_200'
2707+ });
2708+ console.log(url);
2709+ // --------------------------------------------------
2710+ const url = await store.asyncSignatureUrl('ossdemo.png', {
2711+ expires: 3600,
2712+ process: 'image/resize,w_200'
2713+ });
2714+ console.log(url);
2715+ ```
2716+
26392717### .putACL(name, acl[, options])
26402718
26412719Set object's ACL.
0 commit comments