Home > Web Front-end > JS Tutorial > Node.js method of reading files into strings_node.js

Node.js method of reading files into strings_node.js

WBOY
Release: 2016-05-16 15:52:27
Original
1160 people have browsed it

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);

Copy after login

I hope this article will be helpful to everyone’s node.js programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template