chrome-launcher icon indicating copy to clipboard operation
chrome-launcher copied to clipboard

RangeError [ERR_FS_FILE_TOO_LARGE]: File size (3055630622) is greater than 2 GiB

Open fregante opened this issue 1 year ago • 0 comments

I'm getting this error when using the launcher through web-ext run

node:internal/errors:491
    ErrorCaptureStackTrace(err);
    ^

RangeError [ERR_FS_FILE_TOO_LARGE]: File size (3055630622) is greater than 2 GiB
    at new NodeError (node:internal/errors:400:5)
    at tryCreateBuffer (node:fs:434:13)
    at Object.readFileSync (node:fs:479:14)
    at /usr/local/lib/node_modules/web-ext/node_modules/chrome-launcher/dist/chrome-launcher.js:272:48
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_FS_FILE_TOO_LARGE'
}

Node.js v18.13.0

This is due to the line:

https://github.com/GoogleChrome/chrome-launcher/blob/6004448388b79d067774259622a7ba2881a540d0/src/chrome-launcher.ts#L373

Possible improvements:

  • avoid reading the whole file into memory (definitely)
  • trim the file after it reaches like 5 megabytes (ideally)
  • catch the error and provide more information (bare minimum, but not great)

fregante avatar Mar 10 '23 10:03 fregante