You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2026. It is now read-only.
docs: Clarify whether setMetadata is replacing existing metadata or updating only specified fields #2513
From the NodeJS documentation, it is not clear enough whether calling file.setMetadata({contentType: 'image/png'}) would remove existing metadata fields on the field (as they are not specified) or would only change the content type.
To understand this, one must dig deeply into the NodeJS SDK to understand the exact behaviour and cross-reference it with the Cloud Storage API.
From my understanding, setMetadata is using PATCH, so any existing metadata would stay the same, correct?
--
Could we please update the documentation to make this clearer?
e.g. Set the metadata of the object. Uses PATCH method, meaning it only modifies passed fields and leaves unspecified fields unchanged.
Thanks for opening an issue. We are aware of a current documentation problem for some functions such as setMetadata where the full documentation is not being displayed. For example, what you are requesting is already present at:
Activity
ddelgrosso1 commentedon Aug 26, 2024
Thanks for opening an issue. We are aware of a current documentation problem for some functions such as
setMetadatawhere the full documentation is not being displayed. For example, what you are requesting is already present at:nodejs-storage/src/file.ts
Lines 943 to 949 in 57b28f1
We are working to resolve the issue.