Monday 8 May 2017

Absolute paths in nodejs on OSX? No such file or directory

In nodejs, I am attempting to write into the Documents folder of the user (on OSX):

var logger = fs.createWriteStream('~/Documents/somefolderwhichexists/'+title+'.txt');

This gives me an error, but I am not sure what is wrong. The error says

Uncaught Exception: Error: ENOENT: no such file or directory

How could I use an absolute path here? Or what is my mistake?



via George Welder

No comments:

Post a Comment