Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: runtime deprecation for fs.SyncWriteStream #10467

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,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.

[alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
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 @@ -2025,12 +2025,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')
});