-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwatch.js
More file actions
24 lines (20 loc) · 706 Bytes
/
Copy pathwatch.js
File metadata and controls
24 lines (20 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import chokidar from 'chokidar'
import chalk from 'chalk';
import callGemini from './callGemini.js';
import fs from 'fs'
fs.appendFileSync(
"invoked.txt",
`Invoked : ${new Date().toLocaleString()}`,
"utf-8"
);
const watcher = chokidar.watch('C:\\Users\\darry\\Downloads', {
persistent: true,
awaitWriteFinish: true,
atomic: true,
ignoreInitial: true
});
watcher
.on('ready', () => console.log(chalk.green('Initial scan complete. Ready for changes')))
.on('add', async (path) => await callGemini('add', path))
.on('change', async (path) => await callGemini('chang', path))
.on('unlink', async (path) => await callGemini('delet', path));