fs.watch fired twice when I change the watched file

后端 未结 12 1458
星月不相逢
星月不相逢 2020-12-09 01:30
 fs.watch( \'example.xml\', function ( curr, prev ) {
   // on file change we can read the new xml
   fs.readFile( \'example.xml\',\'utf8\', function ( err, data ) {         


        
12条回答
  •  时光取名叫无心
    2020-12-09 02:15

    The fs.watch api:

    1. is unstable
    2. has known "behaviour" with regards repeated notifications. Specifically, the windows case being a result of windows design, where a single file modification can be multiple calls to the windows API

提交回复
热议问题