Skip to content

Commit

Permalink
fs: runtime deprecation for fs.SyncWriteStream
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jasnell committed Feb 23, 2017
1 parent 4f638f6 commit 7a55e34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,10 @@ The [`util._extend()`][] API has been deprecated.
<a id="DEP0061"></a>
### DEP0061: fs.SyncWriteStream

Type: Documentation-only
Type: Runtime

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

<a id="DEP0062"></a>
### DEP0062: node --debug
Expand Down
16 changes: 9 additions & 7 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const FSReqWrap = binding.FSReqWrap;
const FSEvent = process.binding('fs_event_wrap').FSEvent;
const internalFS = require('internal/fs');
const internalURL = require('internal/url');
const internalUtil = require('internal/util');
const assertEncoding = internalFS.assertEncoding;
const stringToFlags = internalFS.stringToFlags;
const SyncWriteStream = internalFS.SyncWriteStream;
const getPathFromURL = internalURL.getPathFromURL;

Object.defineProperty(exports, 'constants', {
Expand Down Expand Up @@ -2024,12 +2024,14 @@ WriteStream.prototype.close = ReadStream.prototype.close;
WriteStream.prototype.destroySoon = WriteStream.prototype.end;

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

0 comments on commit 7a55e34

Please sign in to comment.