使用ReadStream方法延时读取文件

Posted 自留记

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用ReadStream方法延时读取文件相关的知识,希望对你有一定的参考价值。

const fs = require(‘fs‘);
let file = fs.createReadStream("filenpath.js");
file.pause();
file.on("data", function(data) {
    console.log("读取到数据:");
     console.log(data);
});
setTimeout(function() {
    file.resume();
}, 3000);

 

以上是关于使用ReadStream方法延时读取文件的主要内容,如果未能解决你的问题,请参考以下文章