Skip to content

Commit

Permalink
fix: remove obsolete dependency destroy
Browse files Browse the repository at this point in the history
The [`destroy`](https://www.npmjs.com/package/destroy) package was was used to handle stream destruction across legacy Node.js versions (>=0.8), addressing bugs in specific versions. Since we now officially support only Node.js 18 and newer, we can safely remove this dependency and replace it with a direct call to `stream.destroy()`.
  • Loading branch information
Phillip9587 authored and wesleytodd committed Jan 23, 2025
1 parent 91c9199 commit 07a8f59
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions lib/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/

var createError = require('http-errors')
var destroy = require('destroy')
var getBody = require('raw-body')
var iconv = require('iconv-lite')
var onFinished = require('on-finished')
Expand Down Expand Up @@ -90,7 +89,7 @@ function read (req, res, next, parse, debug, options) {
// unpipe from stream and destroy
if (stream !== req) {
req.unpipe()
destroy(stream, true)
stream.destroy()
}

// read off entire request
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"bytes": "3.1.2",
"content-type": "~1.0.5",
"debug": "3.1.0",
"destroy": "1.2.0",
"http-errors": "2.0.0",
"iconv-lite": "0.5.2",
"on-finished": "2.4.1",
Expand Down

0 comments on commit 07a8f59

Please sign in to comment.