UNPKG

nginx-binaries

Version:

A downloader for nginx and njs standalone binaries.

18 lines 646 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchJson = exports.fetch = void 0; const node_fetch_1 = require("node-fetch"); async function fetch(url, init) { const resp = await (0, node_fetch_1.default)(url, init); if (resp.status !== 200) { throw new node_fetch_1.FetchError(`Unexpected response for ${url}: ${resp.status} ${resp.statusText}`, 'invalid-response'); } return resp; } exports.fetch = fetch; async function fetchJson(url, opts) { const resp = await fetch(url, opts); return await resp.json(); } exports.fetchJson = fetchJson; //# sourceMappingURL=fetch.js.map