The fs
module provides four different ways to write data to files. You can write data to a file in a single call, write chunks using synchronous writes, write chunks using asynchronous writes, or stream writes through a Writable
stream. Each of these methods accepts either a String
or Buffer
object as input. The following sections describe how to use these methods.