Module fs
Rew comes with the node's fs
module by default, you don't need to import this module as it is there by default.
Functions
read
: Reads fileswrite
: Writes to filesexists
: Checks if file existsfstat
: Gives you the file statsrm
: Removes fileschmod
: Changes file permissionsmkdir
: Creates Directoriesls
: Lists Directories
Helpers
basename(string, suffix)
: Gives the path's basenamedirname
: Gives the dirname of the given pathextname
: Gives the file extension of the given pathpjoin
: Joins given pathspresolve
: Resolves given paths
Examples
coffee
myFile = read './myfile.txt'
print myFile # file content
write './myfile.txt', "My content"
# Allow access for everyone
chmod './myfile.txt', 077
print 'It Exists' if exists './myfile.txt'