Skip to content

File download fails for gib files #155

@holographix

Description

@holographix

What happened

I was trying to retrieve a 1.5Gb file from a folder and when I execute the getFile function after a bit of downloading time I got what I think is a buffer related error.

Code executed

Here is the excerpt a test version of my original code that ends up with the same error.
note: googleDriveSvc is just a custom class that wraps the node-google-drive functions

let gfiles = await this.googleDriveSvc.listFiles();
for(let i=0; i<gfiles.length;i++) {
   const gfile = gfiles[i];
   await this.googleDriveSvc.getFile(gfile, this.tmpFolder);
}

Error

buffer.js:799
    return this.utf8Slice(start, end);
                ^

Error: Cannot create a string longer than 0x1fffffe8 characters
    at Buffer.toString (buffer.js:799:17)
    at Request.<anonymous> (/var/lib/jenkins/workspace/ferrini-strapi/google-drive-s3-cron/node_modules/request/request.js:1128:39)
    at Request.emit (events.js:327:22)
    at Request.EventEmitter.emit (domain.js:467:12)
    at IncomingMessage.<anonymous> (/var/lib/jenkins/workspace/ferrini-strapi/google-drive-s3-cron/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at IncomingMessage.EventEmitter.emit (domain.js:467:12)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'ERR_STRING_TOO_LONG'

Versions

I am using node v. 12.19.0 on a ubuntu 20.04 machine, but also on OSX with node 14.16.0 I got the same results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions