The example in this article describes the method of node.js reading files into strings. Share it with everyone for your reference. The specific analysis is as follows:
Node.js is a JavaScript toolkit for writing high-performance web servers, and a series of changes began here. Uniquely, Node.js assumes you are running it in a POSIX environment, Linux or Mac OS X.
The main code is as follows:
var fs = require('fs'); var file = fs.readFileSync(path, "utf8"); console.log(file);
I hope this article will be helpful to everyone’s node.js programming.