Skip to content

Tankōbon / main/services/library-sync / resyncLibrary

Function: resyncLibrary() ​

resyncLibrary(repo, folders, onProgress, inspect, extractCover?, writeNfos?): Promise<ResyncSummary>

Defined in: main/services/library-sync.ts:77

Walks every folder again: new comics are added (as a folder scan does), then the entries under that folder whose file no longer exists are removed, with their credits and reading-list places. Safety rules, because a removal loses the user's progress, rating and tags: a folder that can't be read as a directory is skipped entirely (an unplugged drive must not empty the library), and an entry goes only when stat says the file is gone (ENOENT), not merely absent from the walk, which skips the subfolders it can't read. Entries outside every folder (a file added on its own) are checked one by one afterwards: they go when their file is gone and the directory that held it is still readable, so a vanished drive or folder keeps them. Comics inside the folders whose cover is missing get it extracted (extractCover, which says whether it made one; a cloud placeholder is skipped, since reading it would download it). Comics inside the folders that have no .nfo sidecar get one written from their library information (unless writeNfos is off); no other file on disk is touched.

Parameters ​

repo ​

LibraryRepository

folders ​

string[]

onProgress ​

(progress) => void

inspect ​

(filePath) => Promise<ArchiveSummary>

extractCover? ​

(filePath) => Promise<boolean>

writeNfos? ​

boolean = true

Returns ​

Promise<ResyncSummary>