Skip to content

Node.js built with icu_small returns error upon loading ArrayBuffer #40

@jelzo

Description

@jelzo

The following snippet:

const arrayBuffer = (await axios(temporaryDownloadUrl, {
        responseType: 'arraybuffer'
    })).data.buffer;
    const data = new hdf5.File(arrayBuffer);

Returns:

RangeError: The "ascii" encoding is not supported
RangeError[ERR_ENCODING_NOT_SUPPORTED]: The "ascii" encoding is not supported
at new NodeError(node: internal / errors: 393: 5)
at new TextDecoder(node: internal / encoding: 403: 15)
at DataObjects._decode_link_msg(/home/deb4693 / nodevenv / domains / xxx.xx / node_dev / 18 / lib / node_modules / jsfive / dist / cjs / index.js: 5552: 16)
at DataObjects._iter_links_btree_v2(/home/deb4693 / nodevenv / domains / xxx.xx / node_dev / 18 / lib / node_modules / jsfive / dist / cjs / index.js: 5586: 40)
at _iter_links_btree_v2.next( < anonymous > )
at DataObjects._iter_link_from_link_info_msg(/home/deb4693 / nodevenv / domains / xxx.xx / node_dev / 18 / lib / node_modules / jsfive / dist / cjs / index.js: 5571: 19)
at _iter_link_from_link_info_msg.next( < anonymous > )
at DataObjects.iter_links(/home/deb4693 / nodevenv / domains / xxx.xx / node_dev / 18 / lib / node_modules / jsfive / dist / cjs / index.js: 5499: 21)
at iter_links.next( < anonymous > )
at Function.fromEntries( < anonymous > )

Environment:
Node.js 18.9.1

Cause:
Many production Node.js hosting environments are built with small-icu and not the full icu data, so the module can't use encodings other than utf-8, utf-16, utf-16be in TextDecoder(encoding).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions