For example. var fs = require('fs'); Syntax. fs.readFile( filename, encoding, callback_function ) Parameters. The method accept three parameters as mentioned above and described below. Return Value. It returns the contents/data stored in file or error if any Output. readFile called undefined.