diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 8b36e0c3aa8d7c..329754a20d996d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2548,6 +2548,20 @@ APIs that do not make sense to use in userland. File streams should always be opened through their corresponding factory methods [`fs.createWriteStream()`][] and [`fs.createReadStream()`][]) or by passing a file descriptor in options. + +### DEP0XXX: `FSWatcher.start()`are internal + + +Type: Runtime + +The `FSWatcher.prototype.start()` function is an undocumented internal API that +does not make ense to use in userland. + [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`--throw-deprecation`]: cli.html#cli_throw_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js index 4dfa83c3b218e2..f236892d0d3fc2 100644 --- a/lib/internal/fs/watchers.js +++ b/lib/internal/fs/watchers.js @@ -22,6 +22,8 @@ const { toNamespacedPath } = require('path'); const { validateUint32 } = require('internal/validators'); const assert = require('internal/assert'); +const { deprecate } = require('internal/util'); + const kOldStatus = Symbol('kOldStatus'); const kUseBigint = Symbol('kUseBigint'); @@ -174,6 +176,11 @@ FSWatcher.prototype[kFSWatchStart] = function(filename, } }; +FSWatcher.prototype.start = deprecate( + FSWatcher.prototype[kFSWatchStart], + 'FSWatcher.prototype.start() is deprecated', + 'DEP0XXX'); + // This method is a noop if the watcher has not been started or // has already been closed. FSWatcher.prototype.close = function() {