I've been trying to find a way to write to file when using NodeJS, but no success. Can you help me with this.
Thanks.
I've been trying to find a way to write to file when using NodeJS, but no success. Can you help me with this.
Thanks.
Node actually has a pretty typical filesystem API. Was there some specific problem you are having?
There's lots of detail in the filesystem API. The most common way (as far as I know) is:
fs.writeFile("/tmp/test", "Hey there!", function(err) {
if(err) {
sys.puts(err);
} else {
sys.puts("The file was saved!");
}
});
You may wish also to see file upload implementation using Node.js as an example.