Ask coding questions

← Back to all posts
Does anybody know how to write different files in node.js
Ravost

My code:

I have tried fs but it doesn't seem to work

Answered by Highwayman [earned 5 cycles]
View Answer
Voters
Ravost
Comments
hotnewtop
Highwayman

please provide the repl in addition to the code- it's hard to find a bug like that without all the context.

Ravost
Highwayman

Just looking at the placement, that looks like a file that would be served to the client, and thus is not run by nodejs. @Ravost

Ravost

@Highwayman so i can't make or write text to files in my file?

Highwayman

yup. not without executing the javascript file as nodejs, which is only for backend.
@Ravost