{"id":16777047,"url":"https://github.com/fb55/encoding-sniffer","last_synced_at":"2026-03-17T18:14:56.267Z","repository":{"id":37039045,"uuid":"422943464","full_name":"fb55/encoding-sniffer","owner":"fb55","description":"HTML encoding sniffer, with stream support","archived":false,"fork":false,"pushed_at":"2026-03-09T20:35:30.000Z","size":2647,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-12T10:57:46.771Z","etag":null,"topics":["encoding-sniffer","html","html-specification","nodejs-streams"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fb55.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["fb55"]}},"created_at":"2021-10-30T17:10:29.000Z","updated_at":"2026-03-09T20:35:33.000Z","dependencies_parsed_at":"2023-10-14T19:32:17.923Z","dependency_job_id":"9d3de3a1-8aae-4672-9b2a-baf51be9f25e","html_url":"https://github.com/fb55/encoding-sniffer","commit_stats":{"total_commits":431,"total_committers":2,"mean_commits":215.5,"dds":0.09048723897911837,"last_synced_commit":"d180b8b53648ada353e37a78f9c84e774e44d541"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fb55/encoding-sniffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fb55%2Fencoding-sniffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fb55%2Fencoding-sniffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fb55%2Fencoding-sniffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fb55%2Fencoding-sniffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fb55","download_url":"https://codeload.github.com/fb55/encoding-sniffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fb55%2Fencoding-sniffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30628405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encoding-sniffer","html","html-specification","nodejs-streams"],"created_at":"2024-10-13T07:11:51.167Z","updated_at":"2026-03-17T18:14:56.260Z","avatar_url":"https://github.com/fb55.png","language":"TypeScript","funding_links":["https://github.com/sponsors/fb55"],"categories":[],"sub_categories":[],"readme":"# encoding-sniffer [![Node.js CI](https://github.com/fb55/encoding-sniffer/actions/workflows/nodejs-test.yml/badge.svg)](https://github.com/fb55/encoding-sniffer/actions/workflows/nodejs-test.yml)\n\nAn implementation of the HTML Standard's\n[encoding sniffing algorithm](https://html.spec.whatwg.org/multipage/syntax.html#encoding-sniffing-algorithm),\nwith stream support.\n\nThis module wraps around [`@exodus/bytes`](https://github.com/ExodusOSS/bytes)\nto make decoding buffers and streams incredibly easy.\n\n## Features\n\n- Support for streams\n- Support for XML encoding types, including UTF-16 prefixes and\n  `\u003c?xml encoding=\"...\"\u003e`\n- Allows decoding streams and buffers with a single function call\n\n## Installation\n\n```bash\nnpm install encoding-sniffer\n```\n\n## Usage\n\n```js\nimport { DecodeStream, getEncoding, decodeBuffer } from \"encoding-sniffer\";\n\n/**\n * All functions accept an optional options object.\n *\n * Available options are (with default values):\n */\nconst options = {\n    /**\n     * The maximum number of bytes to sniff. Defaults to `1024`.\n     */\n    maxBytes: 1024,\n    /**\n     * The encoding specified by the user. If set, this will only be overridden\n     * by a Byte Order Mark (BOM).\n     */\n    userEncoding: undefined,\n    /**\n     * The encoding specified by the transport layer. If set, this will only be\n     * overridden by a Byte Order Mark (BOM) or the user encoding.\n     */\n    transportLayerEncodingLabel: undefined,\n    /**\n     * The default encoding to use, if no encoding can be detected.\n     *\n     * Defaults to `\"windows-1252\"`.\n     */\n    defaultEncoding: \"windows-1252\",\n};\n\n// Use the `DecodeStream` transform stream to automatically decode\n// the contents of a stream as they are read\nconst decodeStream = new DecodeStream(options);\n\n// Or, use the `getEncoding` function to detect the encoding of a buffer\nconst encoding = getEncoding(buffer, options);\n\n// Use the `decodeBuffer` function to decode the contents of a buffer\nconst decodedBuffer = decodeBuffer(buffer, options);\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](/LICENSE) file\nfor more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffb55%2Fencoding-sniffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffb55%2Fencoding-sniffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffb55%2Fencoding-sniffer/lists"}