The fs.readFile()
method is used to read the contents of a file asynchronously. It takes the path of the file to be read and a callback function as arguments. The callback function is called with two arguments, err
and data
. If an error occurs while reading the file, the err
argument will contain the error object. Otherwise, the data
argument will contain the contents of the file.