Registry / storage / pouchdb-fetch

pouchdb-fetch

JSON →
library9.0.0jsnpmunverified

PouchDB's internal fetch() utility, version 9.0.0. This package provides an isomorphic HTTP fetch function tailored for PouchDB's database communication. It is part of the PouchDB monorepo and is not intended for direct public use. The version is pegged to PouchDB's version and does not follow semantic versioning. It wraps the native fetch API with PouchDB-specific error handling and defaults. Release cadence follows PouchDB releases, which are irregular. Key differentiator: designed for internal PouchDB consumption; for generic fetch, use native fetch or node-fetch.

npm install pouchdb-fetch
INSTALL
IMPORT
SIG · POUCHDB-FETCH
P
pouchdb-fetch
storagejavascriptv9.0.0
harness data pending
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.

pouchdbFetch
import fetch from 'pouchdb-fetch'
import { fetch } from 'pouchdb-fetch'
This package exports a default function; named import fetch is incorrect.
default
const fetch = require('pouchdb-fetch')
const { fetch } = require('pouchdb-fetch')
CommonJS require returns the default export directly, not an object.
type
import fetch from 'pouchdb-fetch/types'
import { PouchDBFetch } from 'pouchdb-fetch'
TypeScript types are exported from a separate path 'pouchdb-fetch/types', not named exports.

Shows how to import and use pouchdb-fetch for HTTP requests with CouchDB.

import fetch from 'pouchdb-fetch'; import PouchDB from 'pouchdb'; // Usage inside a PouchDB plugin or custom adapter const db = new PouchDB('mydb'); const url = 'http://localhost:5984/mydb/doc'; const response = await fetch(url, { method: 'GET', headers: { 'Authorization': 'Basic ' + btoa('user:pass') } }); const data = await response.json(); console.log(data);
Debug
Known issues
gotchaThis package does not follow semver; version is pegged to PouchDB's version. Use exact versions with --save-exact.
fix
npm install --save-exact pouchdb-fetch
affects: *
deprecatedConsider using native fetch() instead of pouchdb-fetch for new projects. pouchdb-fetch is an internal utility.
fix
Use the global fetch API available in Node 18+ and modern browsers, or node-fetch.
affects: >=9.0.0
gotchapouchdb-fetch wraps fetch-cookie for cookie handling; cookies are stored in memory by default. May cause unexpected behavior in long-running processes.
fix
Manage cookie jars explicitly if needed, or use a custom fetch implementation.
affects: *
breakingv8.0.0 changed the default export from a named fetch to a default function; existing code using import { fetch } will break.
fix
Change import fetch from 'pouchdb-fetch' to default import.
affects: >=8.0.0
Errors
Common errors & fixes
Cannot read properties of undefined (reading 'fetch')
Using named import fetch instead of default import.
fix
change import { fetch } from 'pouchdb-fetch' to import fetch from 'pouchdb-fetch'
Error: Module "pouchdb-fetch" does not exist at the import path
Package not installed or version mismatch (semver-free zone).
fix
npm install --save-exact pouchdb-fetch@9.0.0
TypeError: fetch is not a function
Using require incorrectly with destructuring assignment.
fix
const fetch = require('pouchdb-fetch'); // not const { fetch } = require('pouchdb-fetch');
Upgrade
Version history
9.0.0latest on npm
Audit
Dependencies
node-fetchrequiredPolyfill for fetch in Node.js environments
fetch-cookierequiredCookie handling for fetch requests
pouchdb-utilsrequiredUtility functions for PouchDB internals
pouchdb-errorsrequiredPouchDB-specific error types
Agent activity
12 hits · last 30 days
node
12
Resources
pouchdb-fetch — npm install pouchdb-fetch · libregistry