node.js - nodeJS 写入文件的内容怎么不是按次序的?
PHP中文网
PHP中文网 2017-04-17 14:47:18
0
4
600

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(4)
小葫芦

Because it’s asynchronous

Peter_Zhu

fs.appendFile Asynchronous, please use fs.appendFileSync

for synchronization

https://nodejs.org/api/fs.htm...

大家讲道理

It is recommended that you concatenate the strings before writing them to the file. . .

阿神

Most nodejs file operation APIs are divided into asynchronous/synchronous (fs.xxx/fs.xxxSync). Just change it to synchronized function content.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template