GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow setting of custom metadata · Issue #368 · googleapis/google-cloud-node

Allow setting of custom metadata #368

New issue
Copy link
New issue
Copy link
Closed
Closed
Allow setting of custom metadata#368
Copy link
Assignees
stephenplusplus
Labels
🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.
Milestone
Storage Stable

Description

@ggoodman
ggoodman
opened on Jan 31, 2015
Issue body actions

I understand from the documents for cloud storage that it is possible to set custom metadata with the x-goog-meta- prefix as specified here: https://cloud.google.com/storage/docs/reference-headers#xgoogmeta

I've tried to take this approach to set custom metadata on objects created using gcloud-node as follows:

    var stream = file.createWriteStream({
      metadata: {
        'x-goog-meta-entry-type': entry.type,
      }
    });

    stream.once("finish", resolve);
    stream.once("error", reject);
    stream.end(buffer);

However, no objects created using that approach have the custom metadata reflected when requested via file.getMetadata() nor when viewed via the online storage browser.

How can one set custom metadata using gcloud-node?

Activity

Next
  1. jgeewax
    added
    api: storageIssues related to the Cloud Storage API.
    enhancement
    on Feb 2, 2015
  2. jgeewax
    added this to the Storage Stable milestone on Feb 2, 2015
  3. stephenplusplus commented on Feb 2, 2015

    @stephenplusplus
    stephenplusplus
    on Feb 2, 2015
    Contributor
    More actions

    Thanks for catching this! I'm talking to myself about a good solution over in #373 - feel free to chime in :)

  4. ryanseys commented on Feb 2, 2015

    @ryanseys
    ryanseys
    on Feb 2, 2015
    Contributor
    More actions

    Hey @ggoodman nice issue! This raises an entirely different question as well and that is: "Do we have a way to specify custom headers?" I'm going to guess no. But I think that's okay, because doing that is beyond the scope of this library. That being said, I think we do support custom metadata already although it's poorly documented. What you need to do is a set a metadata object within your original metadata object, like so:

    fs.createReadStream('/my/local/file.png')
      .pipe(image.createWriteStream({
        metadata: { 
          contentType: 'image/jpeg',
          metadata: {
            customProperty: 'my cool photo'
          }
        }
      }))
      .on('error', function(err) {});
    Reacted by Mark Lewis
  5. dhermes commented on Feb 2, 2015

    @dhermes
    dhermes
    on Feb 2, 2015
    Contributor
    More actions

    @ggoodman

    Notice the docs you linked to are under the hierarchy

    Cloud Storage API >XML API > API Reference > Headers and Query Parameters
    

    So this header (I'm fairly certain) only applies to the XML API, not the JSON API.

  6. ryanseys commented on Feb 2, 2015

    @ryanseys
    ryanseys
    on Feb 2, 2015
    Contributor
    More actions

    @dhermes Good catch, I did not notice this either.

  7. ggoodman commented on Feb 2, 2015

    @ggoodman
    ggoodman
    on Feb 2, 2015
    Author
    More actions

    Hi @dhermes good catch. I guess I wasn't able to identify the correct api that backs this project. Perhaps that is an issue itself. I consider myself a passable code / documentation spelunker and wasn't able to track this down.

    My path there was:

    1. Have a need for custom metadata
    2. Identify that the underlying service supports custom metadata
    3. Search left and right for anything cloud storage and custom metadata

    I think that a simple fix would be to clarify that custom metadata is settable via the metadata of the metadata in the documents. At the same time, it would be nice to describe how said custom metadata will be returned via the getMetadata() call.

    Thanks for taking a look at this so quickly, @dhermes and @ryanseys.

  8. ggoodman commented on Feb 2, 2015

    @ggoodman
    ggoodman
    on Feb 2, 2015
    Author
    More actions

    I have not tried @ryanseys recommendation, but if true, would obviate this issue and I'd be happy to close. What do you think?

  9. stephenplusplus commented on Feb 4, 2015

    @stephenplusplus
    stephenplusplus
    on Feb 4, 2015
    Contributor
    More actions

    Yeah, I'll close this for now as metadata.metadata should work fine. If you try and that's not correct, just open it back up.

  10. stephenplusplus
    closed this as completedon Feb 4, 2015
  11. yoshi-automation
    added
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 6, 2020
  12. JustinBeckwith
    assigned
    stephenplusplus
    on Feb 1, 2021
  13. chingor13
    added a commit that references this issue on Aug 22, 2022

    chore: add config files for cloud-rad for node.js, delete Node 8 temp…

    b7a9d66
  14. 32 remaining items

  15. GautamSharda
    added a commit that references this issue on Feb 26, 2026

    chore(deps): update dependency typescript to ~3.5.0 (#368)

    12c23a5
  16. GautamSharda
    added a commit that references this issue on Mar 5, 2026

    build: ignore googleapis.com in doc link check (#368)

    8c4c2a0
  17. sofisl
    added 2 commits that reference this issue on Mar 5, 2026

    chore: migrate code from googleapis/gcp-metadata (#53)

    fa9a454

    chore: relocate owl bot post processor (#368)

    b985502
  18. codyoss
    added 2 commits that reference this issue on Mar 9, 2026

    chore: [node] add auto-approve templates, and install dependencies wi…

    432a0f5

    chore: [node] add auto-approve templates, and install dependencies wi…

    6c01ef5
  19. GautamSharda
    added 4 commits that reference this issue on Mar 11, 2026

    refactor(ts): added ts style fix for test/index.ts (#368)

    61f930a

    chore: update owlbot-nodejs dependencies (#368)

    a3a082c

    chore: update owlbot-nodejs dependencies (#368)

    6a547dc

    chore: move CONTRIBUTING.md to root (#368)

    c026913
  20. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    fix(deps): update dependency gcs-resumable-upload to ^0.13.0 (googlea…

    7787889
  21. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    nodejs-bigtable is now GA. (#368)

    4b546a6

    nodejs-bigtable is now GA. (#368)

    53d2848
  22. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    nodejs-bigtable is now GA. (#368)

    2ec257a
  23. thiyaguk09
    added a commit that references this issue on May 5, 2026

    nodejs-bigtable is now GA. (googleapis#368)

    ef6f3b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @stephenplusplus
    stephenplusplus

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    • Storage Stable

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.