编程语言
首页 > 编程语言> > node--文件拷贝

node--文件拷贝

作者:互联网

学习资源推荐

var fs = require('fs')
function fileCopy(src, target) {
        const readStream = fs.createReadStream(src)//源文件路径
        const writeStream = fs.createWriteStream(target)//目标文件路径
        readStream.pipe(writeStream);
}

fileCopy('./1.txt', './2.txt')

标签:node,文件,fs,const,src,fileCopy,拷贝,txt,readStream
来源: https://blog.csdn.net/qq_42813491/article/details/100544625