Registry / devops / iso-web

iso-web

JSON →
library3.1.2jsnpmunverified

Isomorphic JavaScript library providing cross-platform web API implementations including fetch, EventTarget, AbortSignal, Web Crypto (SubtleCrypto), and DNS-over-HTTPS (DoH). Version 3.1.2, actively maintained. Key differentiators: zero-dependency core, supports both Node.js and browser environments, ships TypeScript types, and includes DoH resolver. Release cadence is irregular but frequent (multiple releases per year).

npm install iso-web
INSTALL
IMPORT
SIG · ISO-WEB
I
iso-web
devopsjavascriptv3.1.2
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.

fetch
import { fetch } from 'iso-web'
import fetch from 'iso-web/fetch'
Named export, not default. Works in Node.js 18+ without polyfill.
EventTarget
import { EventTarget } from 'iso-web'
const { EventTarget } = require('iso-web')
ESM-only since v3. Use dynamic import for CJS.
AbortSignal
import { AbortSignal } from 'iso-web'
import { AbortController } from 'iso-web'
AbortController is not re-exported; use global AbortController.
crypto
import { crypto } from 'iso-web'
import crypto from 'crypto'
Exposes Web Crypto API (SubtleCrypto), not Node's crypto module.
doh
import { doh } from 'iso-web'
import { DOH } from 'iso-web'
All lowercase export name.

Demonstrates usage of fetch, crypto, doh, and EventTarget exports with type safety.

import { fetch, crypto, doh, EventTarget } from 'iso-web'; // Fetch example async function getData() { const response = await fetch('https://api.example.com/data'); return response.json(); } // Crypto example async function hashPassword(password) { const encoder = new TextEncoder(); const data = encoder.encode(password); const hash = await crypto.subtle.digest('SHA-256', data); return hash; } // DoH example async function resolveDNS(domain) { const result = await doh.query(domain, 'A'); return result.answers; } // EventTarget example const target = new EventTarget(); target.addEventListener('custom', (e) => console.log(e.detail)); target.dispatchEvent(new CustomEvent('custom', { detail: 'hello' })); console.log('All examples work cross-platform');
Debug
Known issues
breakingv3 made the package ESM-only; CJS require() will throw.
fix
Use dynamic import() or switch to ESM.
affects: >=3.0.0
deprecatedAbortSignal export is deprecated in favor of global AbortSignal in Node 15+.
fix
Use global AbortSignal instead; the export may be removed in v4.
affects: >=3.0.0
gotchacrypto.subtle is undefined in insecure contexts (HTTP).
fix
Ensure your page is served over HTTPS or use a secure context.
affects: all
gotchaDoH queries may fail in browser due to CORS restrictions.
fix
Use a CORS proxy or configure server to allow cross-origin requests.
affects: all
breakingv2 to v3 removed default export; all exports are now named.
fix
Change 'import iso from 'iso-web'' to 'import { fetch } from 'iso-web''.
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'iso-web' or its corresponding type declarations.
TypeScript may not resolve the package types; check tsconfig 'moduleResolution'.
fix
Set 'moduleResolution' to 'node16' or 'bundler' in tsconfig.json.
Unsupported private field on AbortSignal.
Using the deprecated AbortSignal export from iso-web in an environment with native AbortSignal.
fix
Remove the import and use global AbortSignal.
Failed to execute 'digest' on 'SubtleCrypto': Algorithm: Unrecognized name.
Invalid algorithm name passed to crypto.subtle.digest.
fix
Use valid algorithm names like 'SHA-256', 'SHA-384', 'SHA-512'.
Upgrade
Version history
3.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
iso-web — npm install iso-web · libregistry