How andris9/fetch works
This is a Node.js library for fetching URL contents as either a readable stream or a completed response body. The main workflow is: a caller starts a fetch, FetchStream prepares and issues HTTP(S) requests, follows redirects while managing cookies, then emits response metadata and content; fetchUrl collects that content and optionally decodes its charset before invoking the callback. The README also documents gzip/deflate handling and piping streams to files. The excerpts show the core request, cookie, and decoding relationships; other documented capabilities are included where their implementation paths are known.
Main entry points: fetch.js FetchStream · cookiejar.js CookieJar
Components 13
Request and streaming
- FetchStream
lib/fetch.js - Redirect handling
lib/fetch.js
Response processing
- Gzip/deflate decode
lib/fetch.js - fetchUrl
lib/fetch.js - Charset decoding
lib/fetch.js
Cookie management
- CookieJar
lib/cookiejar.js
Other components
- Library caller
- HTTP(S) server
- biskviit store
- Stream consumer
- Result callback
- iconv-lite
- File output
Connections 13
- Library caller → FetchStream: starts stream
README.md - Library caller → fetchUrl: requests body
README.md - FetchStream → HTTP(S) server: issues requests
lib/fetch.js - FetchStream → CookieJar: gets and sets cookies
lib/fetch.js - CookieJar → biskviit store: delegates storage
lib/cookiejar.js - FetchStream → Redirect handling: handles redirects
lib/fetch.js - FetchStream → Gzip/deflate decode: decodes content
README.md - FetchStream → Stream consumer: emits stream
README.md - Stream consumer → File output: pipes content
README.md - fetchUrl → FetchStream: creates stream
lib/fetch.js - fetchUrl → Charset decoding: decodes body
lib/fetch.js - Charset decoding → iconv-lite: uses decoder
lib/fetch.js - fetchUrl → Result callback: returns body and metadata
README.md