Fixing missing return value
This commit is contained in:
parent
6a07f1fa53
commit
05667d10ba
5
lib/epub.d.ts
vendored
5
lib/epub.d.ts
vendored
@ -1,3 +1,4 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
import * as JSZip from "jszip";
|
import * as JSZip from "jszip";
|
||||||
/**
|
/**
|
||||||
* new EPub(fname[, imageroot][, linkroot])
|
* new EPub(fname[, imageroot][, linkroot])
|
||||||
@ -155,7 +156,7 @@ export declare class EPub {
|
|||||||
* an error object, image buffer and image content-type.
|
* an error object, image buffer and image content-type.
|
||||||
* Return only images with mime type image
|
* Return only images with mime type image
|
||||||
**/
|
**/
|
||||||
getImage(id: any): Promise<void>;
|
getImage(id: any): Promise<Buffer>;
|
||||||
/**
|
/**
|
||||||
* EPub#getFile(id, callback) -> undefined
|
* EPub#getFile(id, callback) -> undefined
|
||||||
* - id (String): Manifest id value for a file
|
* - id (String): Manifest id value for a file
|
||||||
@ -164,5 +165,5 @@ export declare class EPub {
|
|||||||
* Finds a file for an id. Returns the file as Buffer. Callback gets
|
* Finds a file for an id. Returns the file as Buffer. Callback gets
|
||||||
* an error object, file contents buffer and file content-type.
|
* an error object, file contents buffer and file content-type.
|
||||||
**/
|
**/
|
||||||
getFile(id: any): Promise<void>;
|
getFile(id: any): Promise<Buffer>;
|
||||||
}
|
}
|
||||||
|
@ -632,14 +632,7 @@ class EPub {
|
|||||||
**/
|
**/
|
||||||
async getFile(id) {
|
async getFile(id) {
|
||||||
if (this.manifest[id]) {
|
if (this.manifest[id]) {
|
||||||
let data = await this.zip.files[this.manifest[id].href].async("nodebuffer");
|
return await this.zip.files[this.manifest[id].href].async("nodebuffer");
|
||||||
// this.zip.files(this.manifest[id].href, (function (err, data) {
|
|
||||||
// if (err) {
|
|
||||||
// callback(new Error("Reading archive failed"));
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// callback(null, data, this.manifest[id]['media-type']);
|
|
||||||
// }).bind(this));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error("File not found");
|
throw new Error("File not found");
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "epub",
|
"name": "epub",
|
||||||
"description": "Parse ePub electronic book files with Node.JS",
|
"description": "Parse ePub electronic book files with Node.JS",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"author": "Andris Reinman",
|
"author": "Andris Reinman",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
|
10
src/epub.ts
10
src/epub.ts
@ -728,15 +728,7 @@ export class EPub {
|
|||||||
**/
|
**/
|
||||||
async getFile(id) {
|
async getFile(id) {
|
||||||
if (this.manifest[id]) {
|
if (this.manifest[id]) {
|
||||||
let data = await this.zip.files[this.manifest[id].href].async("nodebuffer");
|
return await this.zip.files[this.manifest[id].href].async("nodebuffer");
|
||||||
// this.zip.files(this.manifest[id].href, (function (err, data) {
|
|
||||||
// if (err) {
|
|
||||||
// callback(new Error("Reading archive failed"));
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// callback(null, data, this.manifest[id]['media-type']);
|
|
||||||
// }).bind(this));
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error("File not found");
|
throw new Error("File not found");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user