当前位置: 首页 > 后端技术 > Node.js

node可读流转web可读流

时间:2023-04-04 00:46:03 Node.js

用于electron开发//转换方法functiontoReadableStream(nrs){//创建web可读流returnnewReadableStream({//开始阶段调用start(controller){//数据可用nrs.on('data',chunk=>controller.enqueue(chunk))//数据耗尽nrs.on('end',()=>controller.close())}})}