Skip to main content
Download operations require the FILE_DOWNLOAD role. Their generated response type is 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

The wildcard route is exposed as 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 native Response so you can read Content-Disposition:

Download archives

Download an entire series as a ZIP. The parameter is seriesId:
Download a read list as a ZIP. The generated operation names the path parameter id:
Large series and read lists are created on the server and may take time to produce. The SDK does not expose a progress event and does not add retries or caching. 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.
An archive request can be expensive for a large series or read list. Avoid firing duplicate requests from UI rerenders, and surface the server-side wait to users instead of treating a slow response or connection as an immediate failure.

Save a download in Node.js

Node.js 18+ provides Blob and Fetch. Use parseAs: 'blob', convert the result to an ArrayBuffer, and write it with the Node filesystem APIs:
For a server-side download service, keep the 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:
An offline package should retain the book metadata alongside the binary and should be prepared for a missing or changed book between the list and the download. For a single book, 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:
Use the helper with any binary result:

Error handling

The default result is a typed success/error union. Status 401 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.