
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@types/html-encoding-sniffer
Advanced tools
TypeScript definitions for html-encoding-sniffer
npm install --save @types/html-encoding-sniffer
This package contains type definitions for html-encoding-sniffer (https://github.com/jsdom/html-encoding-sniffer#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-encoding-sniffer.
/**
* Determine the Encoding of a HTML Byte Stream.
*
* Implements the HTML Standard's
* [encoding sniffing algorithm](https://html.spec.whatwg.org/multipage/syntax.html#encoding-sniffing-algorithm)
* in all its glory. The most interesting part of this is how it pre-scans the first 1024 bytes in order to search
* for certain `<meta charset>`-related patterns.
*
* @param htmlBytes The typed array containing the (X)HTML source text.
*
* @return The canonical [encoding name](https://encoding.spec.whatwg.org/#names-and-labels)
* for use with the [`whatwg-encoding`](https://github.com/jsdom/whatwg-encoding) or similar package.
*
* @example
* import htmlEncodingSniffer = require("html-encoding-sniffer");
* import * as fs from "fs";
*
* const htmlBytes = fs.readFileSync("./html-page.html");
* const sniffedEncoding = htmlEncodingSniffer(htmlBytes);
*/
declare function sniffHTMLEncoding(htmlBytes: Uint8Array, options?: sniffHTMLEncoding.Options): string;
declare namespace sniffHTMLEncoding {
interface Options {
/**
* An encoding label that is obtained from the "transport layer"
* (probably an HTTP `Content-Type` header), which overrides
* everything but a BOM.
*/
transportLayerEncodingLabel?: string | undefined;
/**
* The ultimate fallback encoding used if no valid encoding is supplied
* by the transport layer, and no encoding is sniffed from the bytes.
*
* @default
* ```
* 'windows-1252'
* ```
*
* Which is recommended by the algorithm's table of suggested
* defaults for "All other locales" (including the `en` locale).
*/
defaultEncoding?: string | undefined;
}
}
export = sniffHTMLEncoding;
These definitions were written by ExE Boss, and BendingBender.
FAQs
TypeScript definitions for html-encoding-sniffer
The npm package @types/html-encoding-sniffer receives a total of 16,952 weekly downloads. As such, @types/html-encoding-sniffer popularity was classified as popular.
We found that @types/html-encoding-sniffer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.