googleapis / googleapis/google-cloud-node

Misleading Sample/Documentation (samples/downloadFolderWithTransferManager.js)

Aperta
#7,347 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
api: storage library: storage samples
Lingua principale
TypeScript
Stelle
3.2k
Fork
712
Merge medio
2g 9h
PR unite (30g)
104

Descrizione

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

- [x] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
- [x] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
- [x] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq
- [x] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
- [x] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
- [x] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples

### Documentation Request

# Fix misleading documentation in downloadFolderWithTransferManager.js sample

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

```javascript
// 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:
```javascript
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](https://cloud.google.com/nodejs/docs/reference/storage/latest/storage/transfermanager)
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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Leggi samples/downloadFolderWithTransferManager.js, iniziando dal commento alla riga 31 e dalla relativa invocazione di downloadManyFiles. Confronta il comportamento dell'esempio con Transfer Manager Reference, quindi assicurati che il codice e la documentazione concordino sul fatto che i file vengano scritti localmente o restituiti come buffer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
google-cloud, javascript
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
1/5
Tempo stimato
Meno di un'ora
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.