Registry / storage / closure-fetch

closure-fetch

JSON →
library0.4.2jsnpmunverified

A minimal fetch implementation designed for compatibility with Google Closure Compiler. Version 0.4.2 provides a subset of the Fetch API specifically for sending ArrayBuffer and plain strings, with response support limited to array buffers. It is intended for use in Closure Compiler-compiled projects where a lightweight, limited fetch wrapper is needed. The library has no active maintenance or release cadence, and lacks full Fetch API coverage (e.g., no JSON, text, or blob responses). Not recommended for general use; consider using the native Fetch API or a polyfill like unfetch or node-fetch for broader compatibility.

storage
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The library exports a named `fetch` function, not a default export.

import { fetch } from 'closure-fetch';

CommonJS require must destructure the named export.

const { fetch } = require('closure-fetch');

Request is also exported for use with Closure Compiler.

import { Request } from 'closure-fetch';

Shows basic usage of fetch to retrieve a binary file as ArrayBuffer, the only supported response type.

import { fetch } from 'closure-fetch'; fetch('/myfile.zip') .then(response => response.arrayBuffer()) .then(buffer => { console.log('Received buffer:', buffer); }) .catch(error => { console.error('Fetch failed:', error); });
Debug
Known footguns
gotchaOnly supports ArrayBuffer responses. Methods like response.json(), response.text(), response.blob() are not available and will throw or return undefined.
gotchaRequest body must be ArrayBuffer or string. Sending JSON objects or FormData will fail.
deprecatedThis package is no longer maintained. No updates or bug fixes are expected.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
19 hits · last 30 days
gptbot
3
amazonbot
3
bytedance
2
ahrefsbot
1
Resources