A fetch-like API for GunDB that provides HTTP-method-based access to Gun decentralized database operations. Version 3.7.7, actively maintained with irregular release cadence. Supports GET, PUT, HEAD methods and special query characters (_ for user/relay queries, - for hex-encoded keys). Enables register/login, pagination, peer management, and relay connections through custom headers. Differentiates from raw Gun by providing a familiar fetch interface for CRUD operations.
npm install gun-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic CRUD operations using gun-fetch: PUT to store data, GET to retrieve, HEAD to check existence. Uses local file storage without relay.
Use the returned fetch function directly: const fetch = gunFetch(options);
Pass Gun instance via options: gunFetch({ gun: myGunInstance })Set relay: true or provide a Gun instance with relay connection.
Always stringify body: body: JSON.stringify(yourData)
Avoid starting data keys with underscore or hex-encode keys starting with `_` using `-` prefix.
Use require('gun-fetch') or check that the package is installed correctly.Pass an options object with at least `file` and `relay` or a `gun` instance.
Run npm install gun to install GunDB as a dependency.