mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 17:57:53 +00:00

... in addition to the event names they currently use. Currently, various internal streams have different events that indicate that the underlying resource has successfully been established. This commit adds ready event for fs and net sockets to standardize on emitting ready for all of these streams. PR-URL: https://github.com/nodejs/node/pull/19408 Fixes: https://github.com/nodejs/node/issues/19304 Reviewed-By: Anna Henningsen <anna@addaleax.net>
14 lines
474 B
JavaScript
14 lines
474 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
const readStream = fs.createReadStream(__filename);
|
|
readStream.on('ready', common.mustCall(() => {}, 1));
|
|
|
|
const writeFile = path.join(tmpdir.path, 'write-fsreadyevent.txt');
|
|
tmpdir.refresh();
|
|
const writeStream = fs.createWriteStream(writeFile, { autoClose: true });
|
|
writeStream.on('ready', common.mustCall(() => {}, 1));
|