package
Implementation of the HTML encoding sniffer algo, with stream support
npm install encoding-snifferGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
An implementation of the HTML Standard's encoding sniffing algorithm, with stream support.
This module wraps around @exodus/bytes
to make decoding buffers and streams incredibly easy.
<?xml encoding="...">npm install encoding-snifferimport { DecodeStream, getEncoding, decodeBuffer } from "encoding-sniffer";
/**
* All functions accept an optional options object.
*
* Available options are (with default values):
*/
const options = {
/**
* The maximum number of bytes to sniff. Defaults to `1024`.
*/
maxBytes: 1024,
/**
* The encoding specified by the user. If set, this will only be overridden
* by a Byte Order Mark (BOM).
*/
userEncoding: undefined,
/**
* The encoding specified by the transport layer. If set, this will only be
* overridden by a Byte Order Mark (BOM) or the user encoding.
*/
transportLayerEncodingLabel: undefined,
/**
* The default encoding to use, if no encoding can be detected.
*
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
This project is licensed under the MIT License. See the LICENSE file for more information.
Estimated unpacked size across 2 packages.
554.6 kB
Includes dependencies.