Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/storage

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/storage - npm Package Compare versions

Comparing version 6.8.0 to 6.9.0

31

build/src/storage.d.ts

@@ -513,2 +513,33 @@ /// <reference types="node" />

* @example
* Create a client with credentials passed
* by value as a JavaScript object
* ```
* const storage = new Storage({
* projectId: 'your-project-id',
* credentials: {
* type: 'service_account',
* project_id: 'xxxxxxx',
* private_key_id: 'xxxx',
* private_key:'-----BEGIN PRIVATE KEY-----xxxxxxx\n-----END PRIVATE KEY-----\n',
* client_email: 'xxxx',
* client_id: 'xxx',
* auth_uri: 'https://accounts.google.com/o/oauth2/auth',
* token_uri: 'https://oauth2.googleapis.com/token',
* auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
* client_x509_cert_url: 'xxx',
* }
* });
* ```
*
* @example
* Create a client with credentials passed
* by loading a JSON file directly from disk
* ```
* const storage = new Storage({
* projectId: 'your-project-id',
* credentials: require('/path/to-keyfile.json')
* });
* ```
*
* @example
* Create a client with an `AuthClient` (e.g. `DownscopedClient`)

@@ -515,0 +546,0 @@ * ```

@@ -405,2 +405,33 @@ "use strict";

* @example
* Create a client with credentials passed
* by value as a JavaScript object
* ```
* const storage = new Storage({
* projectId: 'your-project-id',
* credentials: {
* type: 'service_account',
* project_id: 'xxxxxxx',
* private_key_id: 'xxxx',
* private_key:'-----BEGIN PRIVATE KEY-----xxxxxxx\n-----END PRIVATE KEY-----\n',
* client_email: 'xxxx',
* client_id: 'xxx',
* auth_uri: 'https://accounts.google.com/o/oauth2/auth',
* token_uri: 'https://oauth2.googleapis.com/token',
* auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
* client_x509_cert_url: 'xxx',
* }
* });
* ```
*
* @example
* Create a client with credentials passed
* by loading a JSON file directly from disk
* ```
* const storage = new Storage({
* projectId: 'your-project-id',
* credentials: require('/path/to-keyfile.json')
* });
* ```
*
* @example
* Create a client with an `AuthClient` (e.g. `DownscopedClient`)

@@ -407,0 +438,0 @@ * ```

8

build/src/transfer-manager.d.ts

@@ -63,3 +63,4 @@ /*!

*
* @param {array} [filePaths] An array of fully qualified paths to the files.
* @param {array | string} [filePathsOrDirectory] An array of fully qualified paths to the files or a directory name.
* If a directory name is provided, the directory will be recursively walked and all files will be added to the upload list.
* to be uploaded to the bucket

@@ -83,6 +84,8 @@ * @param {UploadManyFilesOptions} [options] Configuration options.

* // - "local/path/file2.txt" (with the contents of '/local/path/file2.txt')
* const response = await transferManager.uploadManyFiles('/local/directory');
* // Your bucket will now contain all files contained in '/local/directory' maintaining the subdirectory structure.
* ```
* @experimental
*/
uploadManyFiles(filePaths: string[], options?: UploadManyFilesOptions): Promise<UploadResponse[]>;
uploadManyFiles(filePathsOrDirectory: string[] | string, options?: UploadManyFilesOptions): Promise<UploadResponse[]>;
/**

@@ -164,2 +167,3 @@ * @typedef {object} DownloadManyFilesOptions

downloadFileInChunks(fileOrName: File | string, options?: DownloadFileInChunksOptions): Promise<void | DownloadResponse>;
private getPathsFromDirectory;
}

@@ -78,3 +78,4 @@ "use strict";

*
* @param {array} [filePaths] An array of fully qualified paths to the files.
* @param {array | string} [filePathsOrDirectory] An array of fully qualified paths to the files or a directory name.
* If a directory name is provided, the directory will be recursively walked and all files will be added to the upload list.
* to be uploaded to the bucket

@@ -98,6 +99,8 @@ * @param {UploadManyFilesOptions} [options] Configuration options.

* // - "local/path/file2.txt" (with the contents of '/local/path/file2.txt')
* const response = await transferManager.uploadManyFiles('/local/directory');
* // Your bucket will now contain all files contained in '/local/directory' maintaining the subdirectory structure.
* ```
* @experimental
*/
async uploadManyFiles(filePaths, options = {}) {
async uploadManyFiles(filePathsOrDirectory, options = {}) {
var _a;

@@ -117,3 +120,12 @@ if (options.skipIfExists && ((_a = options.passthroughOptions) === null || _a === void 0 ? void 0 : _a.preconditionOpts)) {

const promises = [];
for (const filePath of filePaths) {
let allPaths = [];
if (!Array.isArray(filePathsOrDirectory)) {
for await (const curPath of this.getPathsFromDirectory(filePathsOrDirectory)) {
allPaths.push(curPath);
}
}
else {
allPaths = filePathsOrDirectory;
}
for (const filePath of allPaths) {
const stat = await fs_1.promises.lstat(filePath);

@@ -287,4 +299,15 @@ if (stat.isDirectory()) {

}
async *getPathsFromDirectory(directory) {
const filesAndSubdirectories = await fs_1.promises.readdir(directory, {
withFileTypes: true,
});
for (const curFileOrDirectory of filesAndSubdirectories) {
const fullPath = path.join(directory, curFileOrDirectory.name);
curFileOrDirectory.isDirectory()
? yield* this.getPathsFromDirectory(fullPath)
: yield fullPath;
}
}
}
exports.TransferManager = TransferManager;
//# sourceMappingURL=transfer-manager.js.map
{
"name": "@google-cloud/storage",
"description": "Cloud Storage Client Library for Node.js",
"version": "6.8.0",
"version": "6.9.0",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "author": "Google Inc.",

@@ -136,2 +136,3 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost."

| Download File Using Requester Pays | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadFileUsingRequesterPays.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadFileUsingRequesterPays.js,samples/README.md) |
| Download Folder With Transfer Manager | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadFolderWithTransferManager.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadFolderWithTransferManager.js,samples/README.md) |
| Download Into Memory | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadIntoMemory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadIntoMemory.js,samples/README.md) |

@@ -209,2 +210,3 @@ | Download Many Files With Transfer Manager | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadManyFilesWithTransferManager.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadManyFilesWithTransferManager.js,samples/README.md) |

| Upload a directory to a bucket. | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/uploadDirectory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadDirectory.js,samples/README.md) |
| Upload Directory With Transfer Manager | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/uploadDirectoryWithTransferManager.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadDirectoryWithTransferManager.js,samples/README.md) |
| Upload Encrypted File | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/uploadEncryptedFile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadEncryptedFile.js,samples/README.md) |

@@ -211,0 +213,0 @@ | Upload File | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/uploadFile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadFile.js,samples/README.md) |

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc