- Version:
v10.12.0, v11.1.0
- Platform:
Darwin Mac.r 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64
- Subsystem:
Simply run the code below:
$ node
fs.mkdirSync('xyz')
fs.copyFileSync('xyz', 'abc')
On Windows, it results EPERM, but on mac, it creates an empty directory unexpectedly. The behaviours are not consistent.
Since the API is named copyFile, rather than copyDirectory, it should not be able to copy a directory, and should throw ENOTDIR in my first mind.