comicfiles-fns v0.0.2
What and why
comicfiles-fns are utilitty functions to manage .cbr and .cbz archives for my use in Comicary project (comic library management). The idea is to keep them in different package instead of monolitic app.
Extractor class
new Extractor(file)
creates instance of class with file path provided to constructor
extract(location)
extracts image only (jpg, png) files to temp directory (location is .temp
) by default. Path is relative to file folder.
Returns promise with Array of files (see file result)
removeTemp()
removes temporary folder. Returns promise when done
PageGetter class
static PageGetter.getPage(pageNumber)
returns promise with particular page (first, index 0 by default) that matches file interface (see below)
static PageGetter.saveFile(page, dir, name)
saves page to disk.
- @param page - must match file interface (see below)
- @param dir - directory where to write file
- @param name - name of file, by default
cover.jpg
returns Promise with path to result file
Result file interface
File interface is based directly on node decompress library
{
data: Buffer,
mode: Number,
mtime: String,
path: String,
type: String
}