Node.js: Determine file size on modification

前端 未结 3 1231
深忆病人
深忆病人 2021-01-13 15:11

I\'m watching a file in Node.js and would like to obtain the size of the file each time it changes. How can this be done with fs.watchFile?

This is what

3条回答
  •  萌比男神i
    2021-01-13 15:54

    Use fs.stat in the callback: watchFile just lets you know it changed, it doesn't report the change details.

提交回复
热议问题