| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fdc51a1 commit 8a8b43e
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2076,6 +2076,7 @@ ReadStream.prototype.open = function() { | |||
| 2076 | 2076 | ||
| 2077 | 2077 | self.fd = fd; | |
| 2078 | 2078 | self.emit('open', fd); | |
| 2079 | + self.emit('ready'); | ||
| 2079 | 2080 | // start the flow of data. | |
| 2080 | 2081 | self.read(); | |
| 2081 | 2082 | }); | |
@@ -2234,6 +2235,7 @@ WriteStream.prototype.open = function() { | |||
| 2234 | 2235 | ||
| 2235 | 2236 | this.fd = fd; | |
| 2236 | 2237 | this.emit('open', fd); | |
| 2238 | + this.emit('ready'); | ||
| 2237 | 2239 | }); | |
| 2238 | 2240 | }; | |
| 2239 | 2241 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1158,6 +1158,7 @@ function afterConnect(status, handle, req, readable, writable) { | |||
| 1158 | 1158 | self._unrefTimer(); | |
| 1159 | 1159 | ||
| 1160 | 1160 | self.emit('connect'); | |
| 1161 | + self.emit('ready'); | ||
| 1161 | 1162 | ||
| 1162 | 1163 | // start the first read, or get an immediate EOF. | |
| 1163 | 1164 | // this doesn't actually consume any bytes, because len=0. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,13 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const fs = require('fs'); | ||
| 4 | + const path = require('path'); | ||
| 5 | + const tmpdir = require('../common/tmpdir'); | ||
| 6 | + | ||
| 7 | + const readStream = fs.createReadStream(__filename); | ||
| 8 | + readStream.on('ready', common.mustCall(() => {}, 1)); | ||
| 9 | + | ||
| 10 | + const writeFile = path.join(tmpdir.path, 'write-fsreadyevent.txt'); | ||
| 11 | + tmpdir.refresh(); | ||
| 12 | + const writeStream = fs.createWriteStream(writeFile, { autoClose: true }); | ||
| 13 | + writeStream.on('ready', common.mustCall(() => {}, 1)); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + | ||
| 4 | + // This test ensures that socket.connect can be called without callback | ||
| 5 | + // which is optional. | ||
| 6 | + | ||
| 7 | + const net = require('net'); | ||
| 8 | + | ||
| 9 | + const server = net.createServer(common.mustCall(function(conn) { | ||
| 10 | + conn.end(); | ||
| 11 | + server.close(); | ||
| 12 | + })).listen(0, common.mustCall(function() { | ||
| 13 | + const client = new net.Socket(); | ||
| 14 | + | ||
| 15 | + client.on('ready', common.mustCall(function() { | ||
| 16 | + client.end(); | ||
| 17 | + })); | ||
| 18 | + | ||
| 19 | + client.connect(server.address()); | ||
| 20 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments