views:

567

answers:

3

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.

A: 

Node actually has a pretty typical filesystem API. Was there some specific problem you are having?

thenduks
+3  A: 

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!");
    }
}); 
Brian McKenna
A: 

You may wish also to see file upload implementation using Node.js as an example.

Vladimir Grichina