Skip to content

Instantly share code, notes, and snippets.

@nico1988
Created May 13, 2017 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nico1988/c01d881e41da0444a6844304569865a7 to your computer and use it in GitHub Desktop.
Save nico1988/c01d881e41da0444a6844304569865a7 to your computer and use it in GitHub Desktop.
node 复制文件
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