1
I’m trying to manipulate files with Nodejs, using the fs.copyFile
on my server (Debian Jessie), but I can’t copy files. I’ve done everything to try to solve the problem, already copied exactly the example given in the documentation and replicated the files, but it is always the same error that is returned (including using the fs.copyFileSync
).
The error shown is the TypeError: fs.copyFile is not a function
, and no additional information appears on it.
My code:
const fs = require('fs');
fs.copyFile('/home/savi/teste1.txt', '/home/savi/teste2.txt', (err) => {
if(!err){
console.log("Copiou");
}
});
What is the return of
console.log(fs)
?– Woss
I just found out that, as I researched a generic term in Google to find the nodejs documentation regarding the copy of files, it returned me the documentation page of version V8.6 and not V6.11.3 that I’m using, and that’s definitely the mistake. The Fs.copyFile function only exists in V8.6 version. ;-;
– Wesley Nascimento