Questions tagged [chokidar]

Node.js library for the cross-platform files watching. Used by gulp, browser-sync and webpack.

Node.js library for the cross-platform files watching. Used by gulp, browser-sync and webpack.

81 questions
0
votes
1 answer

watch files in folder changed using regEx

i want watch, changes in the folders: test/index.js te3st/index.js but not changes in te2st/index.js not any teNUMBERst/index.js i using chokidar and got inspiration from here: chokidar with ignored: ignored:…
SL5net
  • 2,282
  • 4
  • 28
  • 44
0
votes
0 answers

watch folder is added using node

i rewrote a example found here Watch a folder for changes using node.js, and print file paths when they are changed using chokidar i want know when a folder is added to my folder (only interested in folders not files). i rewrote the example to: var…
SL5net
  • 2,282
  • 4
  • 28
  • 44
0
votes
0 answers

How to copy files and folders using fs-extra in Nuxt

i'm on Nuxtjs 2.15.4 and I'm trying to create multi themes for my app. The flow is very simple: I have a themes folder with my themes folder within. At nuxt build/dev a module will be called: const path = require('path') const chokidar =…
Mojtaba Barari
  • 1,127
  • 1
  • 15
  • 49
0
votes
1 answer

How to Run chokidar in the background (persistent: true)?

I am writing a node.js program that needs to watch for (add/delete/update) files in a folder. I am using chokidar for watching the files. Here's the code async function updateIndexFile() { console.log({ path }); const pathArray = [] //…
Vaasu Dhand
  • 499
  • 1
  • 8
  • 14
0
votes
1 answer

Accessing the event path of any fired event of many event types when watching files in Gulp

With Gulp, you can access the path of a fired event by using the watch().on() method for each event type: const { watch } = require('gulp'); watch('*.js').on('change', (path, stats) => { console.log(`File ${path} was…
Corey
  • 6,612
  • 4
  • 20
  • 28
0
votes
1 answer

Access file after checking if available in folder

So after checking if any .xml files are present with the below code, how do I access the file? I need to access the file to parse the contents and display. var fileWatcher = require("chokidar"); var watcher = fileWatcher.watch("./*.xml", { …
Crying
  • 1
0
votes
0 answers

Run chokidar commands conditionally

This is my first time with chokidar and I would like to know how to run chokidar commands conditionally from the npm scripts. I need to run run two different scripts, one on start and another on change. I have set chokidar-cli as one of my dev…
Ayan
  • 2,738
  • 3
  • 35
  • 76
0
votes
1 answer

High CPU usage while watching a directory for new files

Currently I am using chokidar to watch a directory. The directory has a large amount of files, and it is constantly being written too. I am also using polling because I need to watch folders on a network. I noticed that when I start watching the…
user6362865
0
votes
1 answer

How to ignore multiple directories and files using electron releoad

I have an Electron project using electron-reload, the file structure is: ./public/templates/ --------- contains some html that should be watched and trigger reload ./public/templates/test/ ---- contains some test/experimental html that should be…
Kevin Kussmaul
  • 270
  • 2
  • 11
0
votes
1 answer

Collect changes in a file every fixed time in node js

I have an external program that is streaming data to a csv file every now and then (but quit a lot). I want to collect every 10 seconds all the changed data and do some processing on it. means I want to process only lines I didn't processed…
Aviram_Nahon
  • 47
  • 2
  • 6
0
votes
0 answers

TypeError: watcher.on(...) is not a function

I get this error when running the below code. I am not sure what could be wrong with the code? TypeError: watcher.on(...) is not a function 'use strict'; const fs = require('fs'); const path = require('path'); var chokidar =…
Andreas
  • 1,121
  • 4
  • 17
  • 34
0
votes
1 answer

chokidar ignore everything except xml files

When it comes to the Chokidar configuration I want to setup the options. I would like to ignore everything except xml files. { "path": "C:/... my path ...", "options": { "ignored": "everything except xml files", "persistent":…
user9945420
0
votes
1 answer

Using chokidar watch file, RegEx for param `ignored` is invalid

I am using chokidar to watch files ending with (.js|.jsx|.scss) as below, but RegEx does not work. if just run /^(?!.*(?:\.jsx?|\.scss)$).*$/, it works fine. const watcher = chokidar.watch('./app', { ignored: /^(?!.*(?:\.jsx?|\.scss)$).*$/, …
licaomeng
  • 919
  • 2
  • 13
  • 27
0
votes
0 answers

Should I always replace backslashes with forward slashes in the paths for cross-platform development on Node.js?

Once, my chokidar watcher (wrapped to gulp.watch()) stops working. After experiments and debugging I found out that cause was double backslashes in globs: gulp.watch([ 'C:\\Users\\i\\projects\\test\\1_Source\\0_Development\\1_Markup/**/*.+(pug)', …
Takeshi Tokugawa YD
  • 670
  • 5
  • 40
  • 124
0
votes
1 answer

How to update chokidar files selection correctly without declaring new variable?

Assume that we created the chokidar instance, but then files selection that should be watched has been changed. If I don't want to create a new variable, is it enough just to assign new chokidar watcher with new files selection to same variable? Of…
Takeshi Tokugawa YD
  • 670
  • 5
  • 40
  • 124