Skip to content

feat(storage): support delete source objects on compose#4360

Draft
nidhiii-27 wants to merge 3 commits into
mainfrom
feat/storage-compose-delete-sources
Draft

feat(storage): support delete source objects on compose#4360
nidhiii-27 wants to merge 3 commits into
mainfrom
feat/storage-compose-delete-sources

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor

Updates compose file sample to support deleting source objects optionally. Fixes b/441557254

Updates compose file sample to support deleting source objects optionally. Fixes b/441557254

[Generated-by: AI]
@nidhiii-27 nidhiii-27 added ai-generated Generated by AI storage-sample-architect Generated by storage-sample-architect skill labels Jun 24, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread storage/composeFile.js
Comment on lines +17 to +23
/**
* 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.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
/**
* 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.
*/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Co-authored by AI Agent

Comment thread storage/composeFile.js
Comment on lines +54 to +56
console.log(
`New composite file ${destinationFileName} was created by combining ${firstFileName} and ${secondFileName}`
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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(', ')}`
);

Comment thread storage/composeFile.js Outdated
await bucket.file(source).delete();
})
);
console.log(`Deleted source objects: ${firstFileName}, ${secondFileName}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of hardcoding the file names in the deletion log message, use sources.join(', ') to dynamically list the deleted source files.

Suggested change
console.log(`Deleted source objects: ${firstFileName}, ${secondFileName}`);
console.log(`Deleted source objects: ${sources.join(', ')}`);

@product-auto-label product-auto-label Bot added api: storage Issues related to the Cloud Storage API. samples Issues that are directly related to samples. labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Generated by AI api: storage Issues related to the Cloud Storage API. samples Issues that are directly related to samples. storage-sample-architect Generated by storage-sample-architect skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant