使用fs.watch但忽略node_modules

问题描述 投票:0回答:1

我正在查看fs.watch的文档

https://nodejs.org/docs/latest/api/fs.html#fs_fs_watch_filename_options_listener

如何查看当前目录中的所有文件,但忽略node_modules?

node.js fs
1个回答
2
投票

看起来不可能。只需看看侦听器中的路径,如果以“node_modules”开头,则不执行任何操作。

除非你在节点运行时不断更新模块,否则它不会对性能造成太大影响,这有点奇怪。

© www.soinside.com 2019 - 2024. All rights reserved.