Skip to content

Commit a977fbe

Browse files
remove unnecessary buffer hack
1 parent 7f1d0f3 commit a977fbe

1 file changed

Lines changed: 2 additions & 24 deletions

File tree

‎doc/api/repl.md‎

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,9 +1046,6 @@ a connection established via [`curl()`][].
10461046
```mjs
10471047
import http from 'node:http';
10481048
import repl from 'node:repl';
1049-
import { Buffer } from 'node:buffer';
1050-
1051-
const buf0 = Buffer.from([0]);
10521049

10531050
const server = http.createServer((req, res) => {
10541051
res.setHeader('content-type', 'multipart/octet-stream');
@@ -1061,24 +1058,14 @@ const server = http.createServer((req, res) => {
10611058
useColors: true,
10621059
useGlobal: false,
10631060
});
1064-
1065-
// Hack to thread stdin and stdout
1066-
// simultaneously in curl's single thread
1067-
const iv = setInterval(() => {
1068-
res.write(buf0);
1069-
}, 100);
1070-
1071-
req.on('close', () => {
1072-
clearInterval(iv);
1073-
});
10741061
});
1062+
10751063
server.listen(8000);
10761064
```
10771065

10781066
```cjs
10791067
const http = require('node:http');
10801068
const repl = require('node:repl');
1081-
const buf0 = Buffer.alloc(1);
10821069

10831070
const server = http.createServer((req, res) => {
10841071
res.setHeader('content-type', 'multipart/octet-stream');
@@ -1091,17 +1078,8 @@ const server = http.createServer((req, res) => {
10911078
useColors: true,
10921079
useGlobal: false,
10931080
});
1094-
1095-
// Hack to thread stdin and stdout
1096-
// simultaneously in curl's single thread
1097-
const iv = setInterval(() => {
1098-
res.write(buf0);
1099-
}, 100);
1100-
1101-
req.on('close', () => {
1102-
clearInterval(iv);
1103-
});
11041081
});
1082+
11051083
server.listen(8000);
11061084
```
11071085

0 commit comments

Comments
 (0)