Skip to content

Commit 7a55e34

Browse files
committed
fs: runtime deprecation for fs.SyncWriteStream
This API was never intended to be made public and was docs-only deprecated in Node.js 6.x. This upgrades to a runtime deprecation for Node.js 8.0.0 PR-URL: #10467 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 4f638f6 commit 7a55e34

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

doc/api/deprecations.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,10 @@ The [`util._extend()`][] API has been deprecated.
509509
<a id="DEP0061"></a>
510510
### DEP0061: fs.SyncWriteStream
511511

512-
Type: Documentation-only
512+
Type: Runtime
513513

514514
The `fs.SyncWriteStream` class was never intended to be a publicly accessible
515-
API.
515+
API. No alternative API is available. Please use a userland alternative.
516516

517517
<a id="DEP0062"></a>
518518
### DEP0062: node --debug

lib/fs.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ const FSReqWrap = binding.FSReqWrap;
1717
const FSEvent = process.binding('fs_event_wrap').FSEvent;
1818
const internalFS = require('internal/fs');
1919
const internalURL = require('internal/url');
20+
const internalUtil = require('internal/util');
2021
const assertEncoding = internalFS.assertEncoding;
2122
const stringToFlags = internalFS.stringToFlags;
22-
const SyncWriteStream = internalFS.SyncWriteStream;
2323
const getPathFromURL = internalURL.getPathFromURL;
2424

2525
Object.defineProperty(exports, 'constants', {
@@ -2024,12 +2024,14 @@ WriteStream.prototype.close = ReadStream.prototype.close;
20242024
WriteStream.prototype.destroySoon = WriteStream.prototype.end;
20252025

20262026
// SyncWriteStream is internal. DO NOT USE.
2027-
// todo(jasnell): "Docs-only" deprecation for now. This was never documented
2028-
// so there's no documentation to modify. In the future, add a runtime
2029-
// deprecation.
2030-
// Deprecation ID: DEP0061
2027+
// This undocumented API was never intended to be made public.
2028+
var SyncWriteStream = internalFS.SyncWriteStream;
20312029
Object.defineProperty(fs, 'SyncWriteStream', {
20322030
configurable: true,
2033-
writable: true,
2034-
value: SyncWriteStream
2031+
get: internalUtil.deprecate(() => {
2032+
return SyncWriteStream;
2033+
}, 'fs.SyncWriteStream is deprecated.', 'DEP0061'),
2034+
set: internalUtil.deprecate((val) => {
2035+
SyncWriteStream = val;
2036+
}, 'fs.SyncWriteStream is deprecated.', 'DEP0061')
20352037
});

0 commit comments

Comments
 (0)