@effect-native/fetch-hooks
v0.2.0
Published
Fetch caching utilities for deterministic API replay
Maintainers
Readme
@effect-native/fetch-hooks
Fetch caching utilities for deterministic API replay in development and testing.
Overview
This package provides utilities for recording and replaying fetch requests, enabling:
- Deterministic test runs - Replay cached responses instead of making real API calls
- Faster development - Avoid network latency during development
- Offline development - Work without network connectivity
- Replay for testing - Deterministically test API integrations
Features
- Request caching - Record fetch requests and cache responses
- Binary response handling - Support for binary/blob responses
- Custom headers - Handle request-specific headers
- Server-sent events - SSE stream replay support
- Filesystem storage - Persistent cache storage
- Environment-aware - Detects Bun/Node.js runtime
Usage
See test files for usage examples:
binary-extractor.test.ts- Binary response handlingcache-manager.test.ts- Cache managementfilesystem-storage.test.ts- File storage operationsrequest-hasher.test.ts- Request hashingsse-handler.test.ts- SSE stream handling
License
MIT
