Para Lula

demorei pra me pronunciar porque pra mim o processo de escrita envolve compreensão e reflexão. escrevo a partir do incomodo. e os últimos dias foram completamente cinzas pra mim. hoje o céu abriu…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to track folder or file changes using Node.js?

How to observe/watch the folders OR files that gets changed using Node.js

Node.js comes with builtin method fs.watch() method that will emit ‘change’ event whenever specific directory or file is modified

Save above code in watch.js file and run the program node watch.js. Make sure you change folder or file name.

Once you run the program, it will continuously watch for any changes in specific folder or file and prints buffer once the changes are found.

Make some changes in folder or file being watched and check the console. You should see buffer on your terminal as shown below — contents of buffer may differ

Add a comment

Related posts:

TALENTA DAILY NEWS

The most-used ethereum software client has published code that includes an activation time for Constantinople, a proposed upgrade that, if enacted by users, would bring additional features and…

Wholesale Zinc Alloy Marijuana Grinder with Handle

The Zinc Alloy Marijuana Grinder with Handle is a perfect quality grinder for marijuana. It has a beautiful design and is made of high-quality Zinc Alloy materials, which makes it very durable. The…

Cryptomarkets and the Standing Waves of Reflexivity

The power of crypto-powered platforms remains game changing. While much of the speculation frenzy in secondary markets bears little relationship to the challenge of migrating the global economy to…