[PR #530] [MERGED] Add file download to node example #690

Closed
opened 2026-03-03 12:31:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/530
Author: @aeaton-overleaf
Created: 7/12/2021
Status: Merged
Merged: 7/13/2021
Merged by: @fsouza

Base: mainHead: node-file-download


📝 Commits (6)

  • 665e435 Add file download to node example
  • 0d54e5b Set validation: false
  • 5160cd8 Set X-Goog-Hash header on download response
  • 1bf4d77 Add both crc32c and md5
  • 1d79271 Remove fixed comment.
  • d5dab68 Don't set empty content-type header on download

📊 Changes

4 files changed (+23 additions, -3 deletions)

View changed files

examples/node/docker-compose.yaml (+9 -0)
📝 examples/node/index.js (+9 -2)
📝 examples/node/package.json (+1 -0)
📝 fakestorage/object.go (+4 -1)

📄 Description

  • Use docker-compose.yaml to start the fake-gcs service (copied from the dotnet example, with the addition of a build path and a volumes mount to load the example data).
  • Add an example of downloading a file from a bucket.

The download example is currently failing when used with @google-cloud/storage > v5.8.1 unless validation: false is set, which isn't ideal - it seems that fake-gcs needs to be setting a x-goog-hash header on the response.

I've added a line of code that sets X-Goog-Hash on the download response, but I'm not sure when either of obj.Crc32c or obj.Md5Hash are guaranteed to be set on the object, so someone with more knowledge of the server will need to finish this off.

Closes #529.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fsouza/fake-gcs-server/pull/530 **Author:** [@aeaton-overleaf](https://github.com/aeaton-overleaf) **Created:** 7/12/2021 **Status:** ✅ Merged **Merged:** 7/13/2021 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `node-file-download` --- ### 📝 Commits (6) - [`665e435`](https://github.com/fsouza/fake-gcs-server/commit/665e435597c1e8c0bbaa86f6b0114256f3f1d5fd) Add file download to node example - [`0d54e5b`](https://github.com/fsouza/fake-gcs-server/commit/0d54e5b66a1443647a068c835af08004124ed3fd) Set validation: false - [`5160cd8`](https://github.com/fsouza/fake-gcs-server/commit/5160cd8442031a25f2d34d97438178f3b9f59b7b) Set X-Goog-Hash header on download response - [`1bf4d77`](https://github.com/fsouza/fake-gcs-server/commit/1bf4d773d633c501b0ec75b24ce5be7332061b17) Add both crc32c and md5 - [`1d79271`](https://github.com/fsouza/fake-gcs-server/commit/1d7927132f1a10d2c5a25942d4e93209075370b3) Remove fixed comment. - [`d5dab68`](https://github.com/fsouza/fake-gcs-server/commit/d5dab68adf4783db4bf30f00e144c8e31425fc89) Don't set empty content-type header on download ### 📊 Changes **4 files changed** (+23 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `examples/node/docker-compose.yaml` (+9 -0) 📝 `examples/node/index.js` (+9 -2) 📝 `examples/node/package.json` (+1 -0) 📝 `fakestorage/object.go` (+4 -1) </details> ### 📄 Description * Use `docker-compose.yaml` to start the `fake-gcs` service (copied from the `dotnet` example, with the addition of a `build` path and a `volumes` mount to load the example data). * Add an example of downloading a file from a bucket. The `download` example is currently failing when used with `@google-cloud/storage` > v5.8.1 unless `validation: false` is set, which isn't ideal - it seems that `fake-gcs` needs to be setting a `x-goog-hash` header on the response. I've added a line of code that sets `X-Goog-Hash` on the download response, but I'm not sure when either of `obj.Crc32c` or `obj.Md5Hash` are guaranteed to be set on the object, so someone with more knowledge of the server will need to finish this off. Closes #529. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:31:11 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#690
No description provided.