1.1.1 • Published 3 months ago

fetch-link-util v1.1.1

Weekly downloads
1,081
License
BSD-2-Clause
Repository
github
Last release
3 months ago

npm License Typed with TypeScript bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

fetch-link-util

helper to extract fetch link header values (https://datatracker.ietf.org/doc/html/rfc8288)

Example

import { getHeaderLink } from "fetch-link-util";

async listAllBranches() {
  let next = "https://api.github.com/repos/arlac77/fetch-link-util/branches";

  do {
    const response = await fetch(next);
    const json = await response.json();

    console.log(json.map(branch => branch.name));
    next = getLink(response.headers);
  } while (next);
}

API

Table of Contents

getHeaderLink

Decodes link header and delivers one href entry.

Parameters

  • headers Headers as given by fetch response
  • rel string of link to retrieve (optional, default "next")

Returns string href for given rel or undefined

install

With npm do:

npm install fetch-link-util

license

BSD-2-Clause

1.1.1

3 months ago

1.1.0

3 months ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

2 years ago

1.0.9

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago