nodeca / probe-image-size

Get image size without full download. Supported image types: JPG, GIF, PNG, WebP, BMP, TIFF, SVG, PSD, ICO.
MIT License
978 stars 77 forks source link

request package is deprecated, consider replacing with an alternative like node-fetch #40

Closed polarathene closed 3 years ago

polarathene commented 4 years ago

The request package has been deprecated. This package only seems to use it in the http.js file, the advice appears to migrate to an alternative like node-fetch.

https://github.com/nodeca/probe-image-size/blob/7d7e4a91d232d2d6fca2339df61432e3c415b0b8/http.js#L38

https://github.com/nodeca/probe-image-size/blob/7d7e4a91d232d2d6fca2339df61432e3c415b0b8/http.js#L57

I'm not raising the issue due to any bug or vulnerabilities, just making you aware of the deprecation as it is raised as a warning during package installs:

warning gatsby-plugin-sharp > probe-image-size > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

Cheers.

konsumer commented 3 years ago

If isomorphic-fetch were used, it might even work on client-side code which would be amazing, instead of this:

error - ./node_modules/request/lib/har.js:3:0
Module not found: Can't resolve 'fs'
puzrin commented 3 years ago

MEMO: https://github.com/tomas/needle looks promissing. Others has suspicious issues in tracker or lack of features.

puzrin commented 3 years ago

https://github.com/nodeca/probe-image-size/commit/40f0968732808dcacfb1000b250e0d278c388727

Switched to needle