content-disposition

  • Version 2.0.0
  • Published
  • 48.3 kB
  • No dependencies
  • MIT license

Install

npm i content-disposition
yarn add content-disposition
pnpm add content-disposition

Overview

Create and parse Content-Disposition header

Index

Functions

function create

create: (filename?: string, options?: CreateOptions) => string;
  • Create an attachment Content-Disposition header.

function decodeExtended

decodeExtended: (str: string) => string | undefined;
  • Decode a RFC 8187 field value (gracefully).

function encodeExtended

encodeExtended: (str: string) => string;
  • Encode a Unicode string for HTTP (RFC 5987).

function format

format: (obj: Partial<ContentDisposition>, options?: FormatOptions) => string;
  • Format object to Content-Disposition header.

function parse

parse: (header: string, options?: ParseOptions) => ContentDisposition;
  • Parse Content-Disposition header string.

Interfaces

interface ContentDisposition

interface ContentDisposition {}

    property parameters

    parameters: Record<string, string>;
    • Content-Disposition parameters, such as "filename"

    property type

    type: string;
    • Content-Disposition type, such as "attachment" or "inline"

    interface CreateOptions

    interface CreateOptions {}

      property fallback

      fallback?: string | boolean;
      • Fallback filename for non-US-ASCII strings. If true, a fallback will be generated by replacing non-US-ASCII characters with "?". If false, no fallback will be generated. true

      property type

      type?: string;
      • Content-Disposition type, defaults to "attachment" "attachment"

      interface FormatOptions

      interface FormatOptions {}

        property extended

        extended?: boolean;
        • Whether to use extended parameter encoding for non-ISO-8859-1 strings. If false, an error will be thrown when formatting such strings. true

        property multipart

        multipart?: boolean;
        • Format parameters as sent by browsers in multipart/form-data. false

        interface ParseOptions

        interface ParseOptions {}

          property extended

          extended?: boolean;
          • Whether to decode RFC 8187 encoded parameters. true

          property multipart

          multipart?: boolean;
          • Parse parameters as sent by browsers in multipart/form-data. false

          Package Files (1)

          Dependencies (0)

          No dependencies.

          Dev Dependencies (4)

          Peer Dependencies (0)

          No peer dependencies.

          Badge

          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/content-disposition.

          • Markdown
            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/content-disposition)
          • HTML
            <a href="https://www.jsdocs.io/package/content-disposition"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>