question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow setting metadata when copying

See original GitHub issue

We store some metadata on images regarding which post a certain image belongs to. We have some cloud functions that listen to new files being added and depending on the metadata we do some actions.

We now want to be able to copy a file to a new location. But because our triggers fire of as soon as we use the copy command we would like to be able to specify what should happen with the metadata.

https://googleapis.dev/nodejs/storage/latest/File.html#copy https://googleapis.dev/nodejs/storage/latest/global.html#CopyOptions

Either we should be able to say, skip copying the metadata.

const file = bucket.file('my-image.png');
file.copy('my-image-copy.png', {
  metadata: null
}

Or we should be able to set the metadata from the copy method.

const file = bucket.file('my-image.png');
file.copy('my-image-copy.png', {
  metadata: {
    thisIsACopy: true
  }
}

What we have tried

  • downloading the file and uploading again. (takes to long, and means extra costs)
  • removing the metadata on the source before copying (not ideal because then we need to put the metadata back again)

Would this be possible?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
frankyncommented, Feb 18, 2021

Good question for @tritone who is on duty right now

0reactions
leoncommented, Mar 19, 2021

Thanks for this! Now we can null out the metadata, which is a start 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Collect, Copy and Move Data Without Changing its ...
The best way to ensure you're not changing the metadata of the data you collect is to "containerize" it. This is done by...
Read more >
Preserve metadata and ACLs using copy activity - Azure Data ...
Learn how to preserve metadata and ACLs when using the copy activity in Azure Data Factory and Synapse Analytics pipelines.
Read more >
AzCopy - how to specify metadata when copying a file to a ...
I'm trying to upload a file to an Azure Blob storage using AzCopy, but I want to include metadata ...
Read more >
Metadata copied by AWS DataSync
Learn how AWS DataSync copies data between storage systems with similar and different metadata structures.
Read more >
Ensure Custom Settings copy across from live -> sandbox
The premise of a sandbox copy is that 'meta data' gets copied across (details of objects, fields, etc) but actual application data does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found