Hacker News new | ask | show | jobs
by chrisbrauns 2079 days ago
Interesting idea. Just a note that the first answer I saw[0] is not correct.

This is given as how to write to a file in Javascript.

const {fs} = require('fs')

fs.writeFileSync('/tmp/myfile.txt', Buffer.from('hello'));

But you can't just do this in plain old JS. It needs to be Node running ES6+

[0]: https://howtoxwithy.com/how-to/b35668da-7cbe-456f-8db5-0d645...

1 comments

That's true. Definitely need a way to distinguish between the two (browser vs. server) sometimes