StreamingResponseBody (unknown) because Komga streams files. Pass parseAs: 'blob' in the options object when you need a browser Blob, then narrow result.data before using it.
Download a book
downloadBookFile1 and has the same flat signature. Use it only when your reverse proxy requires that route:
Read the server filename
The generated result includes the nativeResponse so you can read Content-Disposition:
Download archives
Download an entire series as a ZIP. The parameter isseriesId:
id:
parseAs: 'blob' buffers the response, so use it for ordinary downloads; if you need incremental progress, provide an application-owned fetch/streaming transport and apply the same authentication policy outside the core SDK.
Save a download in Node.js
Node.js 18+ providesBlob and Fetch. Use parseAs: 'blob', convert the result to an ArrayBuffer, and write it with the Node filesystem APIs:
KomgaClient on the server so Basic credentials or API keys never enter a browser bundle. The SDK returns the native Response as result.response; use it for Content-Type, Content-Length, and Content-Disposition when proxying the file to another client.
Batch and offline workflows
For several books, list the books first, then download sequentially or with a bounded worker pool. Sequential requests make back-pressure explicit and avoid exhausting the server’s file-download role:getBookById plus getBookPages can provide the metadata and page count before downloading; do not infer either from the archive bytes.
Browser helper
Keep object URL cleanup in one helper:Error handling
The default result is a typed success/error union. Status401 means the client did not authenticate, 403 means the account lacks FILE_DOWNLOAD, and 404 usually means the requested ID is not available:
Next steps
Books
Browse and manage books.
Read lists
Create reading lists for export.
Authentication
Configure Basic or API-key authentication.