File System: Autor: Thiago Porto
File System: Autor: Thiago Porto
org/api/
File System
The callback is passed two arguments (err, data), where data is the contents of the file.
If no encoding is specified, then the raw buffer is returned.
WriteFile
fs.writeFile(filename, data, [options], callback)#
filename String
data String | Buffer
options Object
encoding String | Null default = 'utf8'
mode Number default = 438 (aka 0666 in Octal)
flag String default = 'w'
callback Function
Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer.
The encoding option is ignored if data is a buffer. It defaults to 'utf8'.
Example:
github.com/tporto
@WaibTecnologia
youtube.com/waibtecnologia
facebook.com/groups/WaibTecnologia/
Site: waib.com.br / Blog: waib.com.br/Blog
Obrigado!