In Node.js, I am attempting to write into the
var logger = fs.createWriteStream('~/Documents/somefolderwhichexists/'+title+'.txt');
Uncaught Exception: Error: ENOENT: no such file or directory
~ is a shorthand, to your home directory, expanded by the Bash shell. You need to use a fully defined path or get the current user name (or home path) dynamically.
To get the current user home path, ty this:
var home = require("os").homedir(); var path = home+'/Documents/somefolderwhichexists/'+title+'.txt'; var logger = fs.createWriteStream(path);