Node Unknown System Error When Copying Large Files (over 2GB)

- 1 answer

I'm getting a cryptic error when trying to use Node's fs.copyFileSync and also tried fs-extra to copy a file and seem to be getting errors when the said file is larger than 2GB.

Additionally for some reason running the same snippet on my MacBook Air with exact same Node version and file produces no problem. Googling for answers seem no avail due to the error given.

I've already checked disk space and permission issues. Copying using Finder manually seems to be fine.

The closest information I can find is on this Github issue:


I created 2 files for testing using mkfile -n 1999m testfile1 and mkfile -n 2g testfile2 then tried to copy them using node. the 1.999GB file worked fine and the 2GB file failed with unknown error. So there is a clear limit of 2GB here for some reason.


  • Mac mini 2018
  • macOS Catalina 10.15 19A602
  • Node 12.13
const fs = require('fs');

fs.copyFileSync('/Users/michael/Movies/wamp/1.mp4', '/Users/michael/Desktop/1.mp4');
    throw err;

Error: UNKNOWN: unknown error, copyfile '/Users/michael/Movies/wamp/1.mp4' -> '/Users/michael/Desktop/1.mp4'
    at Object.copyFileSync (fs.js:1790:3)
    at Object.<anonymous> (/Users/michael/Development/homelab/meiti/copy-test.js:3:4)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11 {   errno: -1429910540,   syscall: 'copyfile',   code: 'UNKNOWN',   path: '/Users/michael/Movies/wamp/1.mp4',   dest: '/Users/michael/Desktop/1.mp4' }


I submitted a bug report and is being fixed in the dependency libuv