@httpland/accept-ranges-parser
Version:
HTTP Accept-Ranges header field parser
15 lines (14 loc) • 645 B
TypeScript
import type { AcceptRanges } from "./types.js";
/** Parses string into {@link AcceptRanges}.
*
* @example
* ```ts
* import { parseAcceptRanges } from "https://deno.land/x/accept_ranges_parser@$VERSION/parse.ts";
* import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
*
* assertEquals(parseAcceptRanges(`none`), ["none"]);
* assertEquals(parseAcceptRanges(`bytes, unknown`), ["bytes", "unknown"]);
* ```
* @throws {SyntaxError} If the input is invalid [`<Accept-Ranges>`](https://www.rfc-editor.org/rfc/rfc9110.html#section-14.3-2) syntax.
*/
export declare function parseAcceptRanges(input: string): AcceptRanges;