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 File.download error · Issue #494 · googleapis/google-cloud-node

Storage File.download error #494

New issue
Copy link
New issue
Copy link
Closed
Closed
Storage File.download error#494
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.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@Marc477
Marc477
opened on Apr 13, 2015
Issue body actions

I think there is an error in this function (storage/file.js):

File.prototype.download = function(options, callback) {
 if (util.is(options, 'function')) {
 callback = options;
 options = {};
}

callback = once(callback);

var destination = options.destination;
delete options.destination;

var fileStream = this.createReadStream(options);

if (destination) {
 fileStream
  .on('error', callback)
  .pipe(fs.createWriteStream(destination))
  .on('error', callback)
  .on('finish', callback);
} else {
var fileContents = new Buffer('');

fileStream
  .on('error', callback)
  .on('data', function(chunk) {
    fileContents = Buffer.concat([fileContents, chunk]);
  })
  .on('complete', function() {
    callback(null, fileContents);
  });
}
};

I dont use the destination option, and the function works, but if I have multiple requests to the same file. Then somtimes the download is pending and never returns anything...

I don't know if it is the once(callback) because it is the same callback for multiple requests but this is strange, I replaced the function with my own code and now it is working:

var iStream = file.gFile.createReadStream();
var fileData = new Buffer('');

iStream.on('error', function(err){
   Log.error(err);
   loadCB(null);
});

iStream.on('data', function(data){
   fileData = Buffer.concat([fileData, data]);
});

iStream.on('complete', function() {
   loadCB(fileData);
});

Activity

Next
  1. stephenplusplus
    added
    api: storageIssues related to the Cloud Storage API.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Apr 13, 2015
  2. stephenplusplus commented on Apr 13, 2015

    @stephenplusplus
    stephenplusplus
    on Apr 13, 2015
    Contributor
    More actions

    Thanks for looking into this! Can you demonstrate how you are making multiple requests?

  3. Marc477 commented on Apr 13, 2015

    @Marc477
    Marc477
    on Apr 13, 2015
    Author
    More actions

    I'm hosting videos on google storage, I use a xml file to retreive the info of the video but I have to edit it server side before sending it to the client (so I use .download to get the xml file from storage to compute engine). If I start 7-8 pages at the same time in my browser, then they all try to get the xml file but some of them will never get a response (pending....) and no errors are thrown server side.

    With the second code below I don't get this error

  4. callmehiphop commented on Jul 28, 2015

    @callmehiphop
    callmehiphop
    on Jul 28, 2015
    Contributor
    More actions

    @Marc477 Are you still experiencing this issue? If so, could you provide code snippets on how you were using File#download (options, etc.)?

    once doesn't augment the actual function, so you should be able to re-use the same callback as many times as you like.

  5. stephenplusplus commented on Aug 24, 2015

    @stephenplusplus
    stephenplusplus
    on Aug 24, 2015
    Contributor
    More actions

    We've made multiple changes to some core aspects of our library since this issue was opened. Without more details, it's hard for us to debug. I hope it's been resolved since you opened this issue @Marc477, but if not, please re-open with anything else you can share that will help us catch the bug.

  6. stephenplusplus
    closed this as completedon Aug 24, 2015
  7. yoshi-automation
    added
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Apr 6, 2020
  8. JustinBeckwith
    assigned
    stephenplusplus
    on Feb 1, 2021
  9. chingor13
    added 3 commits that reference this issue on Aug 22, 2022

    chore: release 3.13.0 (#494)

    e810f12

    chore: release 3.13.0 (#494)

    6ee5e3f

    chore: release 3.13.0 (#494)

    5f3d634
  10. sofisl
    added a commit that references this issue on Sep 16, 2022

    build: add generated samples to .eslintignore (#494)

    c90b715
  11. sofisl
    added a commit that references this issue on Sep 27, 2022

    chore: release 3.1.1 (#494)

    3b95096
  12. 26 remaining items

  13. sofisl
    added a commit that references this issue on Jan 28, 2026

    fix(deps): remove unused dependencies (#494)

    d987370
  14. GautamSharda
    added a commit that references this issue on Feb 2, 2026

    build: remove unused codecov config (#494)

    6b7205c
  15. sofisl
    added a commit that references this issue on Feb 3, 2026

    refactor(dataset): Moves dataset#getTables overloads to correct docum…

    3fe9fd3
  16. GautamSharda
    added a commit that references this issue on Feb 3, 2026

    build: remove unused codecov config (#494)

    9a9f12f
  17. sofisl
    added a commit that references this issue on Feb 4, 2026

    chore: clean up Node.js TOC for cloud-rad (#494)

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

    chore: delete Node 8 presubmit tests (#494)

    8532690
  19. GautamSharda
    added 2 commits that reference this issue on Feb 23, 2026

    chore: delete Node 8 presubmit tests (#494)

    ef17642

    chore: delete Node 8 presubmit tests (#494)

    cbeda35
  20. GautamSharda
    added a commit that references this issue on Mar 5, 2026

    refactor: drop dependency on pify (#494)

    1ab5251
  21. sofisl
    added a commit that references this issue on Mar 5, 2026

    chore: update links in github issue templates and switch to using com…

    998b6c3
  22. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    build: remove unused clang format (#494)

    9b6d7d5

    build: remove unused clang format (#494)

    b0918df
  23. feywind
    added a commit that references this issue on Mar 27, 2026

    test: fix publishTime issues (#494)

    618abd7
  24. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    build: remove unused clang format (#494)

    20f2927
  25. thiyaguk09
    added a commit that references this issue on May 5, 2026

    build: remove unused clang format (googleapis#494)

    ac682ff
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: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    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.