4
votes

Here is my code:

var fs = require('fs');
var util = require('util');
var logFile = fs.createWriteStream('C:/text.txt', { flags: 'a' });
// Or 'w' to truncate the file every time the process starts.
var logStdout = process.stdout;

console.log = function () {
logFile.write(util.format.apply(null, arguments) + '\n');
logStdout.write(util.format.apply(null, arguments) + '\n'); 
}
console.error = console.log;

No matter what I type instead of "C:/text.txt" I either get

Error: ENOENT: no such file or directory, open

or

Error: EACCES: permission denied, open

I tried everything such as "run as administrator" and "elevate", but when it's not the second error message, it's the first one; and when it's not the first one, it's the second one.

I'm soooo confused

1
On windows I think you might want to use 'C:\text.txt'rmcsharry
this way I get "Error: EACCES: permission denied, open", and I gave full permissions to "everyone"Emilio

1 Answers

2
votes

For windows it's better to use \\ in the path to avoid some problems.

C:\\text.txt

This path I use to include pdftk.exe:

C:\\PDFtk\\bin\\pdftk.exe