@google-cloud/storage
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -413,2 +413,24 @@ /** | ||
* }); | ||
* | ||
* //- | ||
* // If you're filtering files with a delimiter, you should use | ||
* // {@link Bucket#getFiles} and set `autoPaginate: false` in order to | ||
* // preserve the `apiResponse` argument. | ||
* //- | ||
* const prefixes = []; | ||
* | ||
* function callback(err, files, nextQuery, apiResponse) { | ||
* prefixes = prefixes.concat(apiResponse.prefixes); | ||
* | ||
* if (nextQuery) { | ||
* bucket.getFiles(nextQuery, callback); | ||
* } else { | ||
* // prefixes = The finished array of prefixes. | ||
* } | ||
* } | ||
* | ||
* bucket.getFiles({ | ||
* autoPaginate: false, | ||
* delimiter: '/' | ||
* }, callback); | ||
*/ | ||
@@ -415,0 +437,0 @@ getFilesStream: Function; |
@@ -16,2 +16,4 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import * as querystring from 'querystring'; | ||
export declare function normalize<T = {}, U = Function>(optionsOrCallback?: T | U, cb?: U): { | ||
@@ -29,1 +31,27 @@ options: T; | ||
}): Array<[string, T]>; | ||
/** | ||
* Encode `str` with encodeURIComponent, plus these | ||
* reserved characters: `! * ' ( )`. | ||
* | ||
* @see [MDN: fixedEncodeURIComponent]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent} | ||
* | ||
* @param {string} str The URI component to encode. | ||
* @return {string} The encoded string. | ||
*/ | ||
export declare function fixedEncodeURIComponent(str: string): string; | ||
/** | ||
* URI encode `uri` for generating signed URLs, using fixedEncodeURIComponent. | ||
* | ||
* Encode every byte except `A-Z a-Z 0-9 ~ - . _`. | ||
* | ||
* @param {string} uri The URI to encode. | ||
* @param [boolean=false] encodeSlash If `true`, the "/" character is not encoded. | ||
* @return {string} The encoded string. | ||
*/ | ||
export declare function encodeURI(uri: string, encodeSlash: boolean): string; | ||
/** | ||
* Serialize an object to a URL query string using util.encodeURI(uri, true). | ||
* @param {string} url The object to serialize. | ||
* @return {string} Serialized string. | ||
*/ | ||
export declare function qsStringify(qs: querystring.ParsedUrlQueryInput): string; |
@@ -18,2 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const querystring = require("querystring"); | ||
function normalize(optionsOrCallback, cb) { | ||
@@ -38,2 +39,48 @@ const options = (typeof optionsOrCallback === 'object' | ||
exports.objectEntries = objectEntries; | ||
/** | ||
* Encode `str` with encodeURIComponent, plus these | ||
* reserved characters: `! * ' ( )`. | ||
* | ||
* @see [MDN: fixedEncodeURIComponent]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent} | ||
* | ||
* @param {string} str The URI component to encode. | ||
* @return {string} The encoded string. | ||
*/ | ||
function fixedEncodeURIComponent(str) { | ||
return encodeURIComponent(str).replace(/[!'()*]/g, c => '%' + | ||
c | ||
.charCodeAt(0) | ||
.toString(16) | ||
.toUpperCase()); | ||
} | ||
exports.fixedEncodeURIComponent = fixedEncodeURIComponent; | ||
/** | ||
* URI encode `uri` for generating signed URLs, using fixedEncodeURIComponent. | ||
* | ||
* Encode every byte except `A-Z a-Z 0-9 ~ - . _`. | ||
* | ||
* @param {string} uri The URI to encode. | ||
* @param [boolean=false] encodeSlash If `true`, the "/" character is not encoded. | ||
* @return {string} The encoded string. | ||
*/ | ||
function encodeURI(uri, encodeSlash) { | ||
// Split the string by `/`, and conditionally rejoin them with either | ||
// %2F if encodeSlash is `true`, or '/' if `false`. | ||
return uri | ||
.split('/') | ||
.map(fixedEncodeURIComponent) | ||
.join(encodeSlash ? '%2F' : '/'); | ||
} | ||
exports.encodeURI = encodeURI; | ||
/** | ||
* Serialize an object to a URL query string using util.encodeURI(uri, true). | ||
* @param {string} url The object to serialize. | ||
* @return {string} Serialized string. | ||
*/ | ||
function qsStringify(qs) { | ||
return querystring.stringify(qs, '&', '=', { | ||
encodeURIComponent: (component) => encodeURI(component, true), | ||
}); | ||
} | ||
exports.qsStringify = qsStringify; | ||
//# sourceMappingURL=util.js.map |
@@ -7,2 +7,11 @@ # Changelog | ||
### [4.0.1](https://www.github.com/googleapis/nodejs-storage/compare/v4.0.0...v4.0.1) (2019-10-31) | ||
### Bug Fixes | ||
* **docs:** missing quote in signed url jsdoc ([#896](https://www.github.com/googleapis/nodejs-storage/issues/896)) ([f2d567f](https://www.github.com/googleapis/nodejs-storage/commit/f2d567f279fee0f48c2d6a607f4066c9da372549)) | ||
* use storage.googleapis.com for api endpoint ([862fb16](https://www.github.com/googleapis/nodejs-storage/commit/862fb16db2990c958c0097252a44c775431a7b3f)) | ||
* **signed-url:** replace encodeURIComponent with custom encoding function ([#905](https://www.github.com/googleapis/nodejs-storage/issues/905)) ([ba41517](https://www.github.com/googleapis/nodejs-storage/commit/ba415179f1d5951742c1b239e0500bbd2a815ddd)) | ||
## [4.0.0](https://www.github.com/googleapis/nodejs-storage/compare/v3.5.0...v4.0.0) (2019-10-17) | ||
@@ -9,0 +18,0 @@ |
{ | ||
"name": "@google-cloud/storage", | ||
"description": "Cloud Storage Client Library for Node.js", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Google Inc.", |
@@ -69,2 +69,4 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
const storage = new Storage(); | ||
// Creates a client from a Google service account key. | ||
// const storage = new Storage({keyFilename: "key.json"}); | ||
@@ -71,0 +73,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
450582
10039
156