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 — storage: resumable uploads · Issue #298 · googleapis/google-cloud-node

storage: resumable uploads #298

New issue
Copy link
New issue
Copy link
Closed
#299
Closed
storage: resumable uploads#298
#299
Copy link
Assignees
silvolu
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

@stephenplusplus
stephenplusplus
opened on Nov 11, 2014
Issue body actions

Big files take big time. Big time means big chances for failure. Currently, if something goes wrong during an upload at 95%, the user is forced to re-upload starting from 0%. Using the resumable upload capabilities of the storage API, we should be able to handle this for our users.

It's not exactly trivial, however. My current idea for a solution involves storing a configuration file on the user/server's drive, where we can store tokens/state of uploads. Yeoman happens to have a tool to enable this for us, https://github.com/yeoman/configstore

Unless there are any objections, or more ideas for solutions, I will try to have a PR this week with this functionality.

Activity

Next
  1. stephenplusplus
    added
    enhancement
    on Nov 11, 2014
  2. ryanseys commented on Nov 11, 2014

    @ryanseys
    ryanseys
    on Nov 11, 2014
    Contributor
    More actions

    What strategy will be taken if writing to disk is not possible due to
    permission issues or some other arbitrary reason?

  3. stephenplusplus commented on Nov 11, 2014

    @stephenplusplus
    stephenplusplus
    on Nov 11, 2014
    ContributorAuthor
    More actions

    I guess fallback to non-resumable behavior. What would make the most sense?

    On Monday, November 10, 2014, Ryan Seys [email protected] wrote:

    What strategy will be taken if writing to disk is not possible due to
    permission issues or some other arbitrary reason?

    —
    Reply to this email directly or view it on GitHub
    #298 (comment)
    .

  4. ryanseys commented on Nov 11, 2014

    @ryanseys
    ryanseys
    on Nov 11, 2014
    Contributor
    More actions

    Exposing the id and other necessary information used to me as a
    developer may be nice so I can store it wherever I want (maybe in data
    store? ;) )

    On Monday, November 10, 2014, Stephen Sawchuk [email protected]
    wrote:

    I guess fallback to non-resumable behavior. What would make the most
    sense?

    On Monday, November 10, 2014, Ryan Seys <[email protected]
    javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

    What strategy will be taken if writing to disk is not possible due to
    permission issues or some other arbitrary reason?

    —
    Reply to this email directly or view it on GitHub
    <
    https://github.com/GoogleCloudPlatform/gcloud-node/issues/298#issuecomment-62487064>

    .

    —
    Reply to this email directly or view it on GitHub
    #298 (comment)
    .

  5. silvolu commented on Nov 11, 2014

    @silvolu
    silvolu
    on Nov 11, 2014
    Contributor
    More actions

    The boto approach might be interesting: the library will automatically retry x times on failures; a tracker file is optional and can be used to save/read the state.

  6. stephenplusplus commented on Nov 11, 2014

    @stephenplusplus
    stephenplusplus
    on Nov 11, 2014
    ContributorAuthor
    More actions

    That boto approach makes sense. We should be able to do the same thing. If a tracker file is provided, we first read it to see if there's already data to use to resume the upload. If not, we store the state of the upload in it and are able to re-use it the next time through.

    • does the tracker file get written to if the upload is successful?
    • is there a standard format the tracker file is written in?
  7. silvolu commented on Nov 11, 2014

    @silvolu
    silvolu
    on Nov 11, 2014
    Contributor
    More actions

    does the tracker file get written to if the upload is successful?

    If the option is passed the file is written, and it's then removed if the upload is successful or if any non-retryable exception is raised.

    is there a standard format the tracker file is written in?

    Looks like is just a line in the tracker file that contains the URI.

  8. stephenplusplus commented on Nov 11, 2014

    @stephenplusplus
    stephenplusplus
    on Nov 11, 2014
    ContributorAuthor
    More actions

    SGTM 👍

  9. stephenplusplus commented on Nov 11, 2014

    @stephenplusplus
    stephenplusplus
    on Nov 11, 2014
    ContributorAuthor
    More actions

    After thinking more on this, I think it might be beneficial to still attempt to handle resumable uploads automatically, without a tracker file having to be provided:

    fs.createReadStream("./photos.zip")
      .pipe(file.createWriteStream())
      .on("error", callback)
    
    bucket.upload("./photos.zip", callback)
    • Start resumable upload
    • Store resumable ID in a config file (using yeoman/configstore)
    • If it succeeds, remove id from file
    • If it fails, emit error/callback with resumable ID / message that says "try again to resume"

    Handling the streaming upload should be possible by counting bytes: https://cloud.google.com/storage/docs/concepts-techniques#unknownresumables

    ** edit: can't read. JSON docs: https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable **

  10. silvolu commented on Nov 11, 2014

    @silvolu
    silvolu
    on Nov 11, 2014
    Contributor
    More actions

    After thinking more on this, I think it might be beneficial to still attempt to handle resumable uploads automatically, without a tracker file having to be provided:

    Yeah, as mentioned the tracker file is optional.

    Store resumable ID in a config file (using yeoman/configstore)

    How is this different from using a tracker file? Can't we just store the ID in memory and on failure emit it?

  11. stephenplusplus commented on Nov 11, 2014

    @stephenplusplus
    stephenplusplus
    on Nov 11, 2014
    ContributorAuthor
    More actions

    Yeah, as mentioned the tracker file is optional ... How is this different from using a tracker file? Can't we just store the ID in memory and on failure emit it?

    By defaulting to "we'll store it in a file for you" but allowing "give us a file to store it in", I think that would create a confusing situation where it's not clear when it makes sense to provide your own file. The file is useless outside of gcloud-node, as far as I know. After playing with this today, I can't even think of a good reason to return the resumable ID to the user -- with it alone, it's not very handy. If they don't use it with gcloud-node, they need to somehow assemble their own request (authenticate the headers, read the last byte sent, discard unused bytes from the retried upload data stream, etc). I'd rather just handle everything, and emit an error as we currently do - if the upload fails for any reason. The user will try again, and we'll automatically pick up where we left off, without them having to think about it.

    The configstore is preferred because the user won't even need to know there is a config file.

  12. silvolu commented on Nov 11, 2014

    @silvolu
    silvolu
    on Nov 11, 2014
    Contributor
    More actions

    SGTM.

  13. stephenplusplus
    added this to the This milestone has been deleted milestone on Nov 14, 2014
  14. silvolu
    closed this as completedin #299on Dec 3, 2014
  15. jgeewax
    added
    api: storageIssues related to the Cloud Storage API.
    on Feb 2, 2015
  16. 45 remaining items

  17. sofisl
    added 2 commits that reference this issue on Feb 4, 2026

    build!: upgrade engines field to >=8.10.0 (#298)

    16dfdc0

    Release v3.0.0 (#298)

    f54ed9b
  18. GautamSharda
    added a commit that references this issue on Feb 5, 2026

    Release v0.6.0 (#298)

    bae6fde
  19. sofisl
    added a commit that references this issue on Feb 17, 2026

    Release v3.0.0 (#298)

    5224315
  20. GautamSharda
    added a commit that references this issue on Feb 23, 2026

    Release v0.6.0 (#298)

    a77bb36
  21. sofisl
    added 2 commits that reference this issue on Feb 24, 2026

    chore: assert.deelEqual => assert.deepStrictEqual (#298)

    78de7dc

    refactor(ts): merge initial TypeScript conversion (#334)

    943b50c
  22. GautamSharda
    added 2 commits that reference this issue on Feb 25, 2026

    chore(main): release 3.2.0 (#298)

    08c5fa1

    Release v0.6.0 (#298)

    5a85b0d
  23. sofisl
    added a commit that references this issue on Feb 26, 2026

    fix(deps): update dependency google-gax to ^0.19.0 (#298)

    bdd7850
  24. codyoss
    added a commit that references this issue on Mar 5, 2026

    build: update auto approve to v2, remove release autoapproving (#1432) (

    831c8b2
  25. GautamSharda
    added a commit that references this issue on Mar 5, 2026

    fix(metadata): include zone on GAE descriptor (#298)

    09ae5ee
  26. sofisl
    added a commit that references this issue on Mar 5, 2026

    build: add config .gitattributes (#298)

    c22f363
  27. GautamSharda
    added a commit that references this issue on Mar 12, 2026

    chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 (#…

    7309ed7
  28. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    refactor(ts): merge initial TypeScript conversion (googleapis#334)

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

Metadata

Metadata

Assignees

  • @silvolu
    silvolu

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.