Skip to content

Misleading Sample/Documentation (samples/downloadFolderWithTransferManager.js) #2620

@staplWaldo

Description

@staplWaldo

Please make sure you have searched for information in the following guides.

Documentation Request

Fix misleading documentation in downloadFolderWithTransferManager.js sample

The documentation comment on line 31 of samples/downloadFolderWithTransferManager.js is misleading:

// The ID of the GCS folder to download. The folder will be downloaded to the local path of the executing code.

However, the current implementation:

await transferManager.downloadManyFiles(folderName);

Actually returns a Buffer[] array rather than downloading files to the local filesystem as the comment suggests.

To actually download files to the local filesystem as documented, the sample should include the passthroughOptions.destination parameter:

await transferManager.downloadManyFiles(folderName, {
  passthroughOptions: {
    destination: `${__dirname}/`
  }
});

This is correctly noted on the Transfer Manager Reference
which was how I was able to find out how I was supposed to write to the file system.

Image

Either update the code to include the destination option, or modify the comment to accurately reflect that the current implementation returns buffers rather than writing to disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the googleapis/nodejs-storage API.samplesIssues that are directly related to samples.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions