Skeudenn / main/decoder/protocol / DecoderMethods
Interface: DecoderMethods ​
Defined in: src/main/decoder/protocol.ts:29
The calls the decoder process answers, as the main process sees them (the arguments, and what the call resolves to). Everything that opens an archive, decodes an image or touches the thumbnail cache goes through here.
Methods ​
cleanArchive() ​
cleanArchive(
filePath,names):CleanedArchive
Defined in: src/main/decoder/protocol.ts:52
Rewrites a CBZ without the entries names (see removeEntries()): the original is replaced only once the new archive has been checked.
Parameters ​
filePath ​
string
names ​
string[]
Returns ​
close() ​
close(
id):void
Defined in: src/main/decoder/protocol.ts:35
Closes an archive opened with open.
Parameters ​
id ​
string
Returns ​
void
convertCbr() ​
convertCbr(
cbrPath,cbzPath):ConvertedArchive
Defined in: src/main/decoder/protocol.ts:57
Writes the CBR at cbrPath as a CBZ at cbzPath (see convertCbrToCbz()): the new archive is checked before it appears, and the CBR is left untouched. Rejects when cbzPath exists or the CBR can't be read.
Parameters ​
cbrPath ​
string
cbzPath ​
string
Returns ​
inspect() ​
inspect(
filePath):ArchiveSummary
Defined in: src/main/decoder/protocol.ts:37
Opens a file just long enough to count its pages, caching its cover on the way.
Parameters ​
filePath ​
string
Returns ​
listJunk() ​
listJunk(
filePath):JunkEntry[] |null
Defined in: src/main/decoder/protocol.ts:47
The files of a CBZ that are not pages; null for a format that can't be rewritten (CBR, PDF). Rejects when the archive can't be read or holds no image.
Parameters ​
filePath ​
string
Returns ​
JunkEntry[] | null
measure() ​
measure(
filePath):PageSizeAverage|null
Defined in: src/main/decoder/protocol.ts:42
Opens a file just long enough to average its pages' dimensions (read from the image headers; a PDF's from its page boxes). Pages that can't be read are left out of the average; null when none could be.
Parameters ​
filePath ​
string
Returns ​
PageSizeAverage | null
open() ​
open(
filePath):ArchiveInfo
Defined in: src/main/decoder/protocol.ts:31
Opens a comic and keeps it open, under the returned handle, until close.
Parameters ​
filePath ​
string
Returns ​
pruneThumbnails() ​
pruneThumbnails(
filePaths):void
Defined in: src/main/decoder/protocol.ts:68
Deletes every thumbnail that isn't one of filePaths'.
Parameters ​
filePaths ​
string[]
Returns ​
void
readPage() ​
readPage(
id,index):ComicPage
Defined in: src/main/decoder/protocol.ts:33
Reads a page of an archive opened with open.
Parameters ​
id ​
string
index ​
number
Returns ​
rebuildThumbnails() ​
rebuildThumbnails(
filePaths):void
Defined in: src/main/decoder/protocol.ts:70
Brings the thumbnails in line with filePaths (after a JSON import).
Parameters ​
filePaths ​
string[]
Returns ​
void
removeThumbnail() ​
removeThumbnail(
filePath):void
Defined in: src/main/decoder/protocol.ts:66
Deletes a book's thumbnail.
Parameters ​
filePath ​
string
Returns ​
void
setThumbnail() ​
setThumbnail(
filePath,image):void
Defined in: src/main/decoder/protocol.ts:64
Replaces a book's cover with the given image (PNG, JPEG, WebP…), shrunk to the thumbnail size; rejects when it isn't a usable image.
Parameters ​
filePath ​
string
image ​
Uint8Array
Returns ​
void
thumbnail() ​
thumbnail(
filePath,archiveId?,cachedOnly?):Uint8Array<ArrayBuffer> |null
Defined in: src/main/decoder/protocol.ts:62
A book's cover thumbnail, generated first when missing (from the open archive archiveId, if any). With cachedOnly, the file is never opened: the cached thumbnail or null.
Parameters ​
filePath ​
string
archiveId? ​
string
cachedOnly? ​
boolean
Returns ​
Uint8Array<ArrayBuffer> | null