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

后端 未结 2 1100
醉话见心
醉话见心 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:10

    Check out https://github.com/TomFrost/FlushWritable – I don't know why it's not written into the Writable core but this should do the trick.

    Also, there's a discussion addressing this on GitHub https://github.com/nodejs/node-v0.x-archive/issues/7348.

提交回复
热议问题