Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/http-link-header) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Installation
npm install --save @types/http-link-header
Summary
This package contains type definitions for http-link-header (https://github.com/jhermsmeier/node-http-link-header).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-link-header.
index.d.ts
/// <reference types="node" />
export = Link;
/**
* Parse & format HTTP link headers according to RFC 8288
*/
declare class Link {
/**
* Creates a new Link by parsing a link header beginning at the provided
* offset
* @param value The header to parse
* @param offset The offset to start at. Defaults to 0.
* @return A new Link
*/
static parse(value: string, offset?: number): Link;
/**
* Determines whether an encoding can be
* natively handled with a `Buffer`
*/
static isCompatibleEncoding(value: string): boolean;
static isSingleOccurenceAttr(attr: string): boolean;
static isTokenAttr(attr: string): boolean;
static escapeQuotes(value: string): string;
static formatExtendedAttribute(attr: string, data: Link.LinkData): string;
/**
* Format a given attribute and it's value
*/
static formatAttribute(attr: string, value: string | Buffer | Array<string | Buffer>): string;
/**
* Link
* @param value Link header to parse
*/
constructor(value?: string);
refs: Link.Reference[];
has(attribute: string, value: string): boolean;
/**
* Get refs where the given attribute has a given value
* @param attribute Attribute name
* @param value Value to match
* @return An array of references
*/
get(attribute: string, value: string): Link.Reference[];
/**
* Get refs with given relation type
* @param value The rel value
* @return An array of references
*/
rel(value: string): Link.Reference[];
set(ref: Link.Reference): Link;
/**
* Parse a link header beginning at the provided offset
* @param value The header to parse
* @param offset The offset to start at. Defaults to 0.
* @return The calling instance
*/
parse(value: string, offset?: number): Link;
}
declare namespace Link {
interface Reference {
uri: string;
rel: string;
[index: string]: string;
}
interface LinkData {
/** @default 'utf-8' */
encoding?: string | undefined;
/** @default 'en' */
language?: string | undefined;
value: string | Buffer;
}
}
Additional Details
- Last updated: Tue, 07 Nov 2023 03:09:37 GMT
- Dependencies: @types/node
Credits
These definitions were written by Christian Rackerseder, Noah Loomans, Harris Lummis, and Piotr Błażejewicz.