mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 20:29:36 +00:00

There are a lot of changes in this commit: 1) Remove the `noAssert` argument from all read and write functions. 2) Improve the performance of all read floating point functions significantly. This is done by switching to TypedArrays as the write floating point write functions. 3) No implicit type coercion for offset and byteLength anymore. 4) Adds a lot of tests. 5) Moves the read and write functions to the internal buffer file to split the files in smaller chunks. 6) Reworked a lot of existing tests. 7) Improve the performane of all all read write functions by using a faster input validation and by improving function logic. 8) Significantly improved the performance of all read int functions. This is done by using a implementation without a loop. 9) Improved error handling. 10) Rename test file to use the correct subsystem. PR-URL: https://github.com/nodejs/node/pull/18395 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
24 lines
574 B
JavaScript
24 lines
574 B
JavaScript
'use strict';
|
|
// Serving up a zero-length buffer should work.
|
|
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
const server = http.createServer((req, res) => {
|
|
const buffer = Buffer.alloc(0);
|
|
res.writeHead(200, { 'Content-Type': 'text/html',
|
|
'Content-Length': buffer.length });
|
|
res.end(buffer);
|
|
});
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
http.get({ port: server.address().port }, common.mustCall((res) => {
|
|
|
|
res.on('data', common.mustNotCall());
|
|
|
|
res.on('end', (d) => {
|
|
server.close();
|
|
});
|
|
}));
|
|
}));
|