-
-
Save nico1988/ab74a8dddd787a8eef212530d790eab8 to your computer and use it in GitHub Desktop.
node 复制文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"); | |
var path = require("path"); | |
fs.readFile(path.join(__dirname, "1.js"), function(err, data) { | |
if (err) { | |
throw err | |
} | |
console.log(data.toString) | |
fs.writeFile(path.join(__dirname, "2.js"), data, function(err, data) { | |
if (err) { | |
throw err | |
} | |
console.log("文件复制成功") | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment