Writing some things down, because every time dependencies need to be bumped, I forget the reason why we're not using node-fetch@latest.
We are using node-fetch@2 and upgrading to v3 requires adding a new dependency:
import fetch from 'node-fetch';
import convertBody from 'fetch-charset-detection';
fetch('https://somewebsite.com').then(async res => {
const text = convertBody(await res.arrayBuffer(), res.headers);
});
The fetch-charset-detection package comes with some rather heavy dependencies of its own:
In particular cheerio's use-case is already covered with jsdom. We might end up doing our own, lighter, charset conversion.
Also worth investigating if charsets are still a problem for the native fetch() (Node v18+), and whether we are better off just waiting it out and removing node-fetch altogether when Node 16 reaches end of life.
Writing some things down, because every time dependencies need to be bumped, I forget the reason why we're not using
node-fetch@latest
.We are using
node-fetch@2
and upgrading to v3 requires adding a new dependency:The
fetch-charset-detection
package comes with some rather heavy dependencies of its own:In particular
cheerio
's use-case is already covered withjsdom
. We might end up doing our own, lighter, charset conversion.Also worth investigating if charsets are still a problem for the native
fetch()
(Node v18+), and whether we are better off just waiting it out and removingnode-fetch
altogether when Node 16 reaches end of life.