diff --git a/node/node-tests.ts b/node/node-tests.ts index 1361a7206f..51bebfa6b0 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -138,6 +138,22 @@ fs.mkdtemp('/tmp/foo-', (err, folder) => { var tempDir: string; tempDir = fs.mkdtempSync('/tmp/foo-'); +fs.watch('/tmp/foo-', (event, filename) => { + console.log(event, filename); +}); + +fs.watch('/tmp/foo-', 'utf8', (event, filename) => { + console.log(event, filename); +}); + +fs.watch('/tmp/foo-', { + recursive: true, + persistent: true, + encoding: 'utf8' +}, (event, filename) => { + console.log(event, filename); +}); + /////////////////////////////////////////////////////// /// Buffer tests : https://nodejs.org/api/buffer.html /////////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 42621d50c4..8c7ffe724e 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1599,7 +1599,8 @@ declare module "fs" { export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; - export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; + export function watch(filename: string, encoding: string, listener?: (event: string, filename: string) => any): FSWatcher; + export function watch(filename: string, options: { persistent?: boolean; recursive?: boolean; encoding?: string }, listener?: (event: string, filename: string) => any): FSWatcher; export function exists(path: string | Buffer, callback?: (exists: boolean) => void): void; export function existsSync(path: string | Buffer): boolean; /** Constant for fs.access(). File is visible to the calling process. */