-
Remove support for Node <22 - by @bjohansebas in #156
Node.js versions prior to 22 are no longer supported. This allows the package to migrate to ESM and rely on
require(esm), which does not work correctly on earlier versions. -
Migrate to TypeScript and publish as ESM-only - by @bjohansebas in #157
CommonJS consumers can keep loading the package through
require(esm). -
Use native
TextDecoderinstead oficonv-lite- by @bjohansebas in #143Supported encodings are now those of the WHATWG Encoding Standard; encodings outside the standard (e.g. UTF-32) now throw a 415 error.
utf-16no longer detects a big-endian BOM and always decodes as little-endian; useutf-16befor big-endian content. -
Remove streams1 support - by @bjohansebas in #144 and #161
Node streams that emit string chunks now error with a 500
stream.encoding.setthrough the callback (previously they were decoded silently, or crashed the process when no encoding was set), matching the web stream path. Streams are expected to implement the readable stream interface (unpipe,pause). -
Validate the
limitoption - by @bjohansebas in #162A
limitthat does not parse to a byte count (e.g.'banana',NaN) now throws aTypeErrorinstead of silently reading with no limit at all.limit: nullremains the explicit way to disable the limit.
-
Support reading WHATWG
ReadableStream(web streams) through the newgetRawBodyWebexport - by @bjohansebas in #148, #160 and #175fetchRequest/Responsebodies,Blob.stream(),TransformStreamreadables, andReadable.toWeb()bridges can be read withgetRawBodyWeb, which takes the same options asgetRawBody;getRawBodyitself keeps accepting only node streams. Streams already locked, read, or cancelled error with a 500stream.not.readable; client aborts are mapped to the same 400request.abortederror as node streams, with the original error incause; string chunks are accepted without an encoding (UTF-8Buffer), but error with a 500stream.encoding.setwhen combined with one, since the stream is already decoded; non-byte chunks (e.g.ArrayBuffer) error with aTypeError. On error the reader lock is released, but the stream is not cancelled; disposing it is up to the caller. -
Add a custom
decoderoption - by @bjohansebas in #145A function compatible with
iconv-lite'sgetDecodercan be plugged in to decode encodings outside the WHATWG Encoding Standard. -
Use native
stream.unpipe()and remove theunpipedependency - by @Phillip9587 in #93 -
Remove the check for a global
Promisewhen no callback is provided - by @bjohansebas in #146 -
Add a benchmark suite - by @bjohansebas in #163
npm run benchcompares the node and web stream paths with realistic request bodies. -
Fail as soon as a stream exceeds its declared
length- by @bjohansebas in #172A body that sends more bytes than its declared
lengthnow errors with a 400request.size.invalidas soon as the excess arrives, rather than buffering the rest first. This bounds memory tolengtheven when nolimitis set. When both are set, alengthoverrun is reported before thelimit's 413.
-
Fix a
lengththat does not parse to a number failing every request - by @bjohansebas in #172Values like
''passed the numeric pre-check but parsed toNaN, so the size check could never match and every request errored with a 400request.size.invalid. They are now treated as no expected length, like any other unparseable value. -
Fix node streams destroyed without an error never settling - by @bjohansebas in #158
They now error through the callback / reject the promise with the same 400
request.abortederror as the web path, instead of never invoking the callback or settling the promise. -
Fix process crash when a custom
decoderthrows while reading node streams - by @bjohansebas in #157
- deps: http-errors@2.0.1
- deps: use tilde notation for dependencies
- deps: iconv-lite@0.7.0
- Avoid false positives in encodingExists by using objects without a prototype
- Remove compatibility check for StringDecoder.end method
- Fix the engines field to reflect support for Node >= 0.10
- deps: iconv-lite@0.6.3
- Fix HKSCS encoding to prefer Big5 codes
- Fix minor issue in UTF-32 decoder's endianness detection code
- Update 'gb18030' encoding to :2005 edition
- Change TypeScript argument to
NodeJS.ReadableStreaminterface - Drop support for Node.js 0.8
- deps: iconv-lite@0.5.2
- Add encoding cp720
- Add encoding UTF-32
- Fix error message for non-stream argument
- Fix error on early async hooks implementations
- Prevent loss of async hooks context
- Prevent hanging when stream is not readable
- deps: http-errors@2.0.0
- deps: depd@2.0.0
- deps: statuses@2.0.1
- deps: bytes@3.1.2
- deps: bytes@3.1.1
- deps: http-errors@1.8.1
- deps: setprototypeof@1.2.0
- deps: toidentifier@1.0.1
- deps: http-errors@1.7.3
- deps: inherits@2.0.4
- deps: bytes@3.1.0
- Add petabyte (
pb) support
- Add petabyte (
- deps: http-errors@1.7.2
- Set constructor name when possible
- deps: setprototypeof@1.1.1
- deps: statuses@'>= 1.5.0 < 2'
- deps: iconv-lite@0.4.24
- Added encoding MIK
- deps: http-errors@1.6.3
- deps: depd@~1.1.2
- deps: setprototypeof@1.1.0
- deps: statuses@'>= 1.3.1 < 2'
- deps: iconv-lite@0.4.23
- Fix loading encoding with year appended
- Fix deprecation warnings on Node.js 10+
- deps: iconv-lite@0.4.19
- Fix ISO-8859-1 regression
- Update Windows-1255
- deps: bytes@3.0.0
- deps: http-errors@1.6.2
- deps: depd@1.1.1
- perf: skip buffer decoding on overage chunk
- Add TypeScript definitions
- Use
http-errorsfor standard emitted errors - deps: bytes@2.5.0
- deps: iconv-lite@0.4.18
- Add support for React Native
- Add a warning if not loaded as utf-8
- Fix CESU-8 decoding in Node.js 8
- Improve speed of ISO-8859-1 encoding
- deps: iconv-lite@0.4.15
- Added encoding MS-31J
- Added encoding MS-932
- Added encoding MS-936
- Added encoding MS-949
- Added encoding MS-950
- Fix GBK/GB18030 handling of Euro character
- deps: bytes@2.4.0
- perf: remove double-cleanup on happy path
- deps: bytes@2.3.0
- Drop partial bytes on all parsed units
- Fix parsing byte string that looks like hex
- deps: bytes@2.2.0
- deps: iconv-lite@0.4.13
- Fix masking critical errors from
iconv-lite - deps: iconv-lite@0.4.12
- Fix CESU-8 decoding in Node.js 4.x
- Fix sync callback when attaching data listener causes sync read
- Node.js 0.10 compatibility issue
- Fix error stack traces to skip
makeError - deps: iconv-lite@0.4.11
- Add encoding CESU-8
- Use
unpipemodule for unpiping requests
- deps: iconv-lite@0.4.10
- Improved UTF-16 endianness detection
- Leading BOM is now removed when decoding
- The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails
- deps: bytes@2.1.0
- Slight optimizations
- Fix a false-positive when unpiping in Node.js 0.8
- Return a promise without callback instead of thunk
- deps: bytes@2.0.1
- units no longer case sensitive when parsing
- Fix hanging callback if request aborts during read
- deps: iconv-lite@0.4.8
- Add encoding alias UNICODE-1-1-UTF-7
- deps: iconv-lite@0.4.7
- Gracefully support enumerables on
Object.prototype
- Gracefully support enumerables on
- deps: iconv-lite@0.4.6
- Fix rare aliases of single-byte encodings
- deps: iconv-lite@0.4.5
- Fix Windows-31J and X-SJIS encoding support
- Fully unpipe the stream on error
- Fixes
Cannot switch to old mode nowerror on Node.js 0.10+
- Fixes
- deps: iconv-lite@0.4.4
- Added encoding UTF-7
- Send invalid encoding error to callback
- deps: iconv-lite@0.4.3
- Added encodings UTF-16BE and UTF-16 with BOM
- Passing string as
optionsinterpreted as encoding - Support all encodings from
iconv-lite
- use
string_decodermodule from npm
- check encoding for old streams1
- support node.js < 0.10.6
- bump bytes
- allow true as an option
- bump bytes
- fix case when length=null
- be less strict on state.encoding check
- add engines
- add err.statusCode and err.type
- allow for encoding option to be true
- pause the stream instead of dumping on error
- throw if the stream's encoding is set
- dont support streams1, throw if dev set encoding
- rename
expectedoption tolength
- republish
- use bytes
- generator support
- update repo
- dump stream on bad headers
- listen to events after defining received and buffers
- Initial release