Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace http

A utility module for HTTP requests

Uses got to enable RFC 7234 compliant HTTP caching

Index

Variables

Functions

Variables

Const client

client: Got = ...

A got instance with default options for HTTP requests.

User agent is set, and includes a mailto, for politeness: https://github.com/CrossRef/rest-api-doc#good-manners--more-reliable-service

Functions

download

  • download(from: string, to: string): Promise<void>
  • Download a file

    Parameters

    • from: string

      The URL to download from

    • to: string

      The file path to download to

    Returns Promise<void>

get

  • get(url: string, options?: Options): Promise<Response<string>>
  • Get content from a URL

    Parameters

    • url: string

      The URL to get

    • options: Options = {}

      Options to pass to got

    Returns Promise<Response<string>>

Generated using TypeDoc