fs.copyFile is not a function

1

I'm trying to manipulate files with NodeJS, using fs.copyFile on my server (Debian Jessie), but I can not copy files. I've done everything to try to solve the problem, I've even copied exactly the example given in the documentation and replicated the files, but it's always the same error that is returned (including using fs.copyFileSync ).

The error displayed is TypeError: fs.copyFile is not a function , and no additional information about it appears.

My code:

const fs = require('fs');

fs.copyFile('/home/savi/teste1.txt', '/home/savi/teste2.txt', (err) => {
    if(!err){
        console.log("Copiou");
    }
});
    
asked by anonymous 27.09.2017 / 03:23

1 answer

1

The fs.copyFile functionality was added only in the 8.5 version of the Node. It was highly anticipated as there was no simple API to copy files before.

Viewing in the documentation is there :

  

Added in: v8.5.0

    
27.09.2017 / 07:16