0.1.6 • Published 2 years ago

@tim-code/node-power-fetch v0.1.6

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

json-fetch

npm install @tim-code/node-power-fetch

A fetch wrapper for HTTP/HTTPS requests that should return well-formed JSON with caching and limiting

Philosophy

import { powerFetchFactory } from "@tim-code/node-power-fetch"
const powerFetch = powerFetchFactory({ cache: true, limit: true }) //default
powerFetch(url, { ...fetchOptions, query: { a: "b" }, body: { c: "d" } })

Instead of true, it is possible to pass an options object for either cache (see FileSystemCache in https://www.npmjs.com/package/node-fetch-cache) or limit (https://www.npmjs.com/package/p-ratelimit). Passing false will disable that feature.

Special Parameters to powerFetch()

selector: a JSON path selector to apply to the result; always produces an array (https://www.npmjs.com/package/jsonpath)

The following come from https://www.npmjs.com/package/@tim-code/json-fetch:

query: appends the object value to the query string of the URL

body: stringifies and sets headers to post the object value

onError: replace error behavior

0.1.6

2 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago