micro-ftch
Wraps nodejs built-in modules and browser fetch into one function
Usage
Can be used in browser and in node.js.
npm install micro-ftch
const fetch = require('micro-ftch');
fetch('https://google.com').then(...)
Options
The list of options that can be supplied as second argument to fetch(url, opts):
export type FETCH_OPT = {
method?: string;
type?: 'text' | 'json' | 'bytes';
redirect: boolean;
expectStatusCode?: number | false;
headers: Record<string, string>;
data?: object;
full: boolean;
keepAlive: boolean;
cors: boolean;
referrer: boolean;
sslAllowSelfSigned: boolean;
sslPinnedCertificates?: string[];
_redirectCount: number;
};
License
MIT License (c) 2020, Paul Miller (https://paulmillr.com)