Socket
Socket
Sign inDemoInstall

@types/http-link-header

Package Overview
Dependencies
2
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/http-link-header

TypeScript definitions for http-link-header


Version published
Weekly downloads
29K
decreased by-14.49%
Maintainers
1
Install size
3.82 MB
Created
Weekly downloads
 

Readme

Source

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.

FAQs

Last updated on 07 Nov 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc