Download the original file
const url = 'http://localhost:8080/api/v1/publications/1/file';const options = { method: 'GET', headers: {Range: 'bytes=0-65535', Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url http://localhost:8080/api/v1/publications/1/file \ --header 'Authorization: Bearer <token>' \ --header 'Range: bytes=0-65535'Serves the file as it is on disk. Supports Range for partial reads and
If-Modified-Since for revalidation. A publication from a source
library is streamed from its source, which may send the whole file
instead of a range, as Komga does. Kavita sends a folder of images as
a ZIP it makes. A chapter from an extension that’s an EPUB or PDF is
downloaded through the extension and sent whole, with an ETag
naming the file; one that’s pages has no file.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Example
bytes=0-65535Responses
Section titled “Responses”The whole file.
Headers
Section titled “Headers”Changes whenever the file’s content changes. Send it back in If-None-Match.
The requested byte range.
Headers
Section titled “Headers”The client’s copy is current.
The request has no valid session token.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The resource does not exist.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The file changed on disk since it was scanned. A rescan has started; retry after it finishes.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The range is outside the file.
The server failed; details are in its log.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The publication is from a source library, and its source couldn’t be
read (source_unavailable) or its extension failed (source_failed);
the message says why.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}