Skip to content

Error upgrading from node-fetch 2.x to node-fetch 3.x + fetch-charset-detection #151

@danburzo

Description

@danburzo

I'm using the upgrade guide for node-fetch 3.x and this code:

import fetch from 'node-fetch';
import convertBody from 'fetch-charset-detection';

fetch(`http://www.zeno.org/Philosophie/M/Hegel,+Georg+Wilhelm+Friedrich/Enzyklop%C3%A4die+der+philosophischen+Wissenschaften+im+Grundrisse/Erster+Teil.+Die+Wissenschaft+der+Logik./2.+Abteilung%3A+Die+Lehre+vom+Wesen`).then(async res => {
    const buf = await res.arrayBuffer();
    const text = convertBody(buf, res.headers);
});

Produces this error:

(node:20518) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/danburzo/projects/percollate/node_modules/iconv-lite/lib/index.js:104
                throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')");
                      ^

Error: Encoding not recognized: 'de' (searched as: 'de')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions