Node: How to wait until a file is completed before processing it?

后端 未结 2 1047
醉话见心
醉话见心 2021-02-20 17:39

My Problem is that I can not be sure when a file has been successfully written to and the file has been closed. Consider the following case:

var fs = require(\'f         


        
2条回答
  •  粉色の甜心
    2021-02-20 18:09

    Do your file's post-processing in the writeable stream's close event:

    outs.on('close', function() {
      <>
    });
    

    Also, no need for the destroySoon after the end, they are one and the same.

提交回复
热议问题