@file-services/node
Advanced tools
Comparing version 7.2.3 to 7.2.4
@@ -6,2 +6,3 @@ "use strict"; | ||
const fs_1 = require("fs"); | ||
const events_1 = require("events"); | ||
const utils_1 = require("@file-services/utils"); | ||
@@ -42,4 +43,10 @@ const { stat } = fs_1.promises; | ||
this.fsWatchers.delete(path); | ||
await (0, events_1.once)(fsWatcher, 'close'); | ||
} | ||
} | ||
const pendingEvent = this.pendingEvents.get(path); | ||
if (pendingEvent) { | ||
clearTimeout(pendingEvent.timerId); | ||
this.pendingEvents.delete(path); | ||
} | ||
} | ||
@@ -50,4 +57,10 @@ async unwatchAllPaths() { | ||
} | ||
for (const { timerId } of this.pendingEvents.values()) { | ||
clearTimeout(timerId); | ||
} | ||
const watcherCloseEvents = Array.from(this.fsWatchers.values(), (watcher) => (0, events_1.once)(watcher, 'close')); | ||
this.pendingEvents.clear(); | ||
this.fsWatchers.clear(); | ||
this.watchedPaths.clear(); | ||
await Promise.all(watcherCloseEvents); | ||
} | ||
@@ -54,0 +67,0 @@ addGlobalListener(listener) { |
{ | ||
"name": "@file-services/node", | ||
"description": "Node.js file system implementation.", | ||
"version": "7.2.3", | ||
"version": "7.2.4", | ||
"main": "dist/index.js", | ||
@@ -11,4 +11,4 @@ "scripts": { | ||
"dependencies": { | ||
"@file-services/types": "^7.2.3", | ||
"@file-services/utils": "^7.2.3" | ||
"@file-services/types": "^7.2.4", | ||
"@file-services/utils": "^7.2.4" | ||
}, | ||
@@ -15,0 +15,0 @@ "files": [ |
import { join } from 'path'; | ||
import { promises as fsPromises, watch, FSWatcher } from 'fs'; | ||
import { once } from 'events'; | ||
import type { IWatchService, WatchEventListener, IWatchEvent, IFileSystemStats } from '@file-services/types'; | ||
@@ -76,4 +77,10 @@ import { SetMultiMap } from '@file-services/utils'; | ||
this.fsWatchers.delete(path); | ||
await once(fsWatcher, 'close'); | ||
} | ||
} | ||
const pendingEvent = this.pendingEvents.get(path); | ||
if (pendingEvent) { | ||
clearTimeout(pendingEvent.timerId); | ||
this.pendingEvents.delete(path); | ||
} | ||
} | ||
@@ -85,4 +92,10 @@ | ||
} | ||
for (const { timerId } of this.pendingEvents.values()) { | ||
clearTimeout(timerId); | ||
} | ||
const watcherCloseEvents = Array.from(this.fsWatchers.values(), (watcher) => once(watcher, 'close')); | ||
this.pendingEvents.clear(); | ||
this.fsWatchers.clear(); | ||
this.watchedPaths.clear(); | ||
await Promise.all(watcherCloseEvents); | ||
} | ||
@@ -89,0 +102,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30435
527
Updated@file-services/types@^7.2.4
Updated@file-services/utils@^7.2.4