While trying to figure out how to manipulate the filesystem, I found that the ‘fs’ module has a bunch of methods and the same methods with the suffix ‘Sync’.
http://puu.sh/h91vy/f511ca93d2.png
(etc)
What is the difference between them? The only difference I can spot (between trying both), is that only the Sync ones work.
Also, secondary question, I found stuff about exists
being deprecated and replaced with access
. Is this still happening? Exists is working for me right now, without a deprecation method.
Tertiary question, readFileSync
seems to return a Buffer
object with a bunch of bytes in it. What’s the best way to convert that to a string (or just read a string out of the file in the first place)?
EDIT: Found the answer later, toString