Skip to content

Instantly share code, notes, and snippets.

@clonn
Created February 7, 2012 15:49
Show Gist options
  • Save clonn/1760348 to your computer and use it in GitHub Desktop.
Save clonn/1760348 to your computer and use it in GitHub Desktop.
node.js file read sample
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-TW" lang="zh-TW">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>node.js index html file</title>
</head>
<body>
<h1>node.js index html file</h1>
</body>
</html>
var fs = require("fs"),
filename = "static/index.html",
encode = "utf8";
fs.readFile(filename, encode, function(err, file) {
console.log(file);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment