From 38a80e41b34f81b5b3c5ec36c3054d88b82a6011 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Sun, 17 Apr 2022 23:44:00 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Reverting=20to=20`.on`=20from=20?= =?UTF-8?q?`.once`=20for=20chokidar=20handlers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/api.service.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/services/api.service.ts b/services/api.service.ts index 84e37ae..f9d7021 100644 --- a/services/api.service.ts +++ b/services/api.service.ts @@ -83,8 +83,6 @@ export default class ApiService extends Service { methods: {}, started(): any { - - // Filewatcher const fileWatcher = chokidar.watch( path.resolve("/comics"), @@ -138,7 +136,7 @@ export default class ApiService extends Service { }; fileWatcher - .once("add", (path, stats) => { + .on("add", (path, stats) => { console.log("Watcher detected new files."); console.log( `File ${path} has been added with stats: ${JSON.stringify( @@ -173,13 +171,13 @@ export default class ApiService extends Service { // )}` // ) // ) - .once( + .on( "unlink", (path) => console.log(`File ${path} has been removed`) ) - .once( + .on( "addDir", (path) =>