feat(storage): support delete source objects on compose#4360
feat(storage): support delete source objects on compose#4360nidhiii-27 wants to merge 3 commits into
Conversation
Updates compose file sample to support deleting source objects optionally. Fixes b/441557254 [Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request introduces a new sample script 'storage/composeFile.js' to demonstrate how to combine multiple files into a single destination file using the Google Cloud Storage API, along with corresponding integration tests in 'storage/system-test/files.test.js'. The feedback suggests correcting a copy-paste error in the JSDoc header that references Access Control Lists instead of file composition, and dynamically joining the source file names in the console log messages rather than hardcoding them.
| /** | ||
| * This application demonstrates how to perform basic operations on bucket and | ||
| * file Access Control Lists with the Google Cloud Storage API. | ||
| * | ||
| * For more information, see the README.md under /storage and the documentation | ||
| * at https://cloud.google.com/storage/docs. | ||
| */ |
There was a problem hiding this comment.
The JSDoc comment describes Access Control Lists (ACLs), which is incorrect and appears to be a copy-paste error. It should be updated to accurately describe composing/combining files.
| /** | |
| * This application demonstrates how to perform basic operations on bucket and | |
| * file Access Control Lists with the Google Cloud Storage API. | |
| * | |
| * For more information, see the README.md under /storage and the documentation | |
| * at https://cloud.google.com/storage/docs. | |
| */ | |
| /** | |
| * This application demonstrates how to compose/combine multiple files into a | |
| * single destination file with the Google Cloud Storage API. | |
| * | |
| * For more information, see the README.md under /storage and the documentation | |
| * at https://cloud.google.com/storage/docs. | |
| */ |
There was a problem hiding this comment.
Done
Co-authored by AI Agent
| console.log( | ||
| `New composite file ${destinationFileName} was created by combining ${firstFileName} and ${secondFileName}` | ||
| ); |
There was a problem hiding this comment.
Instead of hardcoding the file names in the log message, use sources.join(', '). This makes the code more robust and maintainable if the sources array is modified in the future.
| console.log( | |
| `New composite file ${destinationFileName} was created by combining ${firstFileName} and ${secondFileName}` | |
| ); | |
| console.log( | |
| `New composite file ${destinationFileName} was created by combining ${sources.join(', ')}` | |
| ); |
| await bucket.file(source).delete(); | ||
| }) | ||
| ); | ||
| console.log(`Deleted source objects: ${firstFileName}, ${secondFileName}`); |
There was a problem hiding this comment.
Updates compose file sample to support deleting source objects optionally. Fixes b/441557254