Skip to content

Commit

Permalink
fix(index): return types don't support promise rejection values (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Jun 2, 2023
1 parent 867bb8b commit 00a78d8
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 77 deletions.
74 changes: 37 additions & 37 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

* [Poppler](#Poppler)
* [new Poppler([binPath])](#new_Poppler_new)
* [.pdfAttach(file, fileToAttach, outputFile, [options])](#Poppler+pdfAttach) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfDetach(file, [options])](#Poppler+pdfDetach) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfFonts(file, [options])](#Poppler+pdfFonts) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfImages(file, [outputPrefix], [options])](#Poppler+pdfImages) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfInfo(file, [options])](#Poppler+pdfInfo) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfSeparate(file, outputPattern, [options])](#Poppler+pdfSeparate) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfToCairo(file, [outputFile], [options])](#Poppler+pdfToCairo) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfToHtml(file, [outputFile], [options])](#Poppler+pdfToHtml) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfToPpm(file, outputPath, [options])](#Poppler+pdfToPpm) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfToPs(file, [outputFile], [options])](#Poppler+pdfToPs) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfToText(file, [outputFile], [options])](#Poppler+pdfToText) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfUnite(files, outputFile, [options])](#Poppler+pdfUnite) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
* [.pdfAttach(file, fileToAttach, outputFile, [options])](#Poppler+pdfAttach) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfDetach(file, [options])](#Poppler+pdfDetach) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfFonts(file, [options])](#Poppler+pdfFonts) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfImages(file, [outputPrefix], [options])](#Poppler+pdfImages) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfInfo(file, [options])](#Poppler+pdfInfo) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfSeparate(file, outputPattern, [options])](#Poppler+pdfSeparate) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfToCairo(file, [outputFile], [options])](#Poppler+pdfToCairo) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfToHtml(file, [outputFile], [options])](#Poppler+pdfToHtml) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfToPpm(file, outputPath, [options])](#Poppler+pdfToPpm) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfToPs(file, [outputFile], [options])](#Poppler+pdfToPs) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfToText(file, [outputFile], [options])](#Poppler+pdfToText) ⇒ <code>Promise.&lt;string&gt;</code>
* [.pdfUnite(files, outputFile, [options])](#Poppler+pdfUnite) ⇒ <code>Promise.&lt;string&gt;</code>

<a name="new_Poppler_new"></a>

Expand All @@ -28,11 +28,11 @@

<a name="Poppler+pdfAttach"></a>

### poppler.pdfAttach(file, fileToAttach, outputFile, [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfAttach(file, fileToAttach, outputFile, [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Embeds files (attachments) into a PDF file.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand All @@ -46,11 +46,11 @@ Embeds files (attachments) into a PDF file.

<a name="Poppler+pdfDetach"></a>

### poppler.pdfDetach(file, [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfDetach(file, [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Lists or extracts embedded files (attachments) from a PDF file.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand All @@ -69,11 +69,11 @@ Lists or extracts embedded files (attachments) from a PDF file.

<a name="Poppler+pdfFonts"></a>

### poppler.pdfFonts(file, [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfFonts(file, [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Lists the fonts used in a PDF file along with various information for each font.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand All @@ -89,11 +89,11 @@ Lists the fonts used in a PDF file along with various information for each font.

<a name="Poppler+pdfImages"></a>

### poppler.pdfImages(file, [outputPrefix], [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfImages(file, [outputPrefix], [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Saves images from a PDF file as PPM, PBM, PNG, TIFF, JPEG, JPEG2000, or JBIG2 files.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand All @@ -117,11 +117,11 @@ Saves images from a PDF file as PPM, PBM, PNG, TIFF, JPEG, JPEG2000, or JBIG2 fi

<a name="Poppler+pdfInfo"></a>

### poppler.pdfInfo(file, [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfInfo(file, [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Prints the contents of the `Info` dictionary from a PDF file.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand All @@ -148,13 +148,13 @@ Prints the contents of the `Info` dictionary from a PDF file.

<a name="Poppler+pdfSeparate"></a>

### poppler.pdfSeparate(file, outputPattern, [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
Extract single pages from a PDF file,
### poppler.pdfSeparate(file, outputPattern, [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Extracts single pages from a PDF file,
and writes one PDF file for each page to outputPattern.
This will not work if the file is encrypted.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand All @@ -168,11 +168,11 @@ This will not work if the file is encrypted.

<a name="Poppler+pdfToCairo"></a>

### poppler.pdfToCairo(file, [outputFile], [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfToCairo(file, [outputFile], [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Converts a PDF file to EPS/JPEG/PDF/PNG/PS/SVG/TIFF.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand Down Expand Up @@ -229,11 +229,11 @@ Converts a PDF file to EPS/JPEG/PDF/PNG/PS/SVG/TIFF.

<a name="Poppler+pdfToHtml"></a>

### poppler.pdfToHtml(file, [outputFile], [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfToHtml(file, [outputFile], [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Converts a PDF file to HTML.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand Down Expand Up @@ -267,13 +267,13 @@ Converts a PDF file to HTML.

<a name="Poppler+pdfToPpm"></a>

### poppler.pdfToPpm(file, outputPath, [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfToPpm(file, outputPath, [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Converts a PDF file to colour image files in Portable Pixmap (PPM) format,
grayscale image files in Portable Graymap (PGM) format, or monochrome image files
in Portable Bitmap (PBM) format.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand Down Expand Up @@ -323,11 +323,11 @@ in Portable Bitmap (PBM) format.

<a name="Poppler+pdfToPs"></a>

### poppler.pdfToPs(file, [outputFile], [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfToPs(file, [outputFile], [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Converts a PDF file to PostScript (PS).

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand Down Expand Up @@ -379,11 +379,11 @@ Converts a PDF file to PostScript (PS).

<a name="Poppler+pdfToText"></a>

### poppler.pdfToText(file, [outputFile], [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfToText(file, [outputFile], [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Converts a PDF file to TXT.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand Down Expand Up @@ -417,12 +417,12 @@ Converts a PDF file to TXT.

<a name="Poppler+pdfUnite"></a>

### poppler.pdfUnite(files, outputFile, [options]) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
### poppler.pdfUnite(files, outputFile, [options]) ⇒ <code>Promise.&lt;string&gt;</code>
Merges several PDF files in order of their occurrence in the files array to
one PDF result file.

**Kind**: instance method of [<code>Poppler</code>](#Poppler)
**Returns**: <code>Promise.&lt;(string\|Error)&gt;</code> - Promise of stdout string on resolve, or Error object on rejection.
**Returns**: <code>Promise.&lt;string&gt;</code> - A promise that resolves with a stdout string, or rejects with an `Error` object.
**Author**: Frazer Smith

| Param | Type | Description |
Expand Down
24 changes: 12 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Poppler {
* @param {object=} options - Object containing options to pass to binary.
* @param {boolean=} options.printVersionInfo - Print copyright and version info.
* @param {boolean=} options.replace - Replace embedded file with same name (if it exists).
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfAttach(file, fileToAttach, outputFile, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -152,7 +152,7 @@ class Poppler {
* By default, this uses the file name associated with the embedded file (as printed by
* `options.listEmbedded`); the file name can be changed with `options.outputPath`.
* @param {string=} options.userPassword - User password (for encrypted files).
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfDetach(file, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -197,7 +197,7 @@ class Poppler {
* @param {string=} options.ownerPassword - Owner password (for encrypted files).
* @param {boolean=} options.printVersionInfo - Print copyright and version info.
* @param {string=} options.userPassword - User password (for encrypted files). *
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfFonts(file, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -282,7 +282,7 @@ class Poppler {
* @param {boolean=} options.printVersionInfo - Print copyright and version info.
* @param {boolean=} options.tiffFile - Change the default output format to TIFF.
* @param {string=} options.userPassword - Specify the user password for the PDF file.
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfImages(file, outputPrefix, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -393,7 +393,7 @@ class Poppler {
* such as Link Annotations are listed, not URL strings in the text content.
* @param {boolean=} options.printVersionInfo - Print copyright and version info.
* @param {string=} options.userPassword - User password (for encrypted files).
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfInfo(file, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -511,7 +511,7 @@ class Poppler {
* @param {number=} options.lastPageToExtract - Specifies the last page to extract.
* This defaults to the last page of the PDF file.
* @param {boolean=} options.printVersionInfo - Print copyright and version info.
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfSeparate(file, outputPattern, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -645,7 +645,7 @@ class Poppler {
* @param {boolean=} options.transparentPageColor - Use a transparent page color
* instead of white (PNG and TIFF only).
* @param {string=} options.userPassword - Specify the user password for the PDF file.
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfToCairo(file, outputFile, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -804,7 +804,7 @@ class Poppler {
* than this percent of character height.
* @param {boolean=} options.xmlOutput - Output for XML post-processing.
* @param {number=} options.zoom - Zoom the PDF document (default 1.5).
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfToHtml(file, outputFile, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -968,7 +968,7 @@ class Poppler {
* @param {('none'|'packbits'|'jpeg'|'lzw'|'deflate')=} options.tiffCompression - Set TIFF compression.
* @param {boolean=} options.tiffFile - Generate TIFF file instead a PPM file.
* @param {string=} options.userPassword - Specify the user password for the PDF file.
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfToPpm(file, outputPath, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -1199,7 +1199,7 @@ class Poppler {
* @param {number=} options.resolutionXYAxis - Specifies the X and Y resolution, in pixels per
* inch of image files (or rasterized regions in vector output). The default is 300 PPI.
* @param {string=} options.userPassword - User password (for encrypted files).
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfToPs(file, outputFile, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -1379,7 +1379,7 @@ class Poppler {
* @param {boolean=} options.rawLayout - Keep the text in content stream order. This is a
* hack which often undoes column formatting, etc. Use of raw mode is no longer recommended.
* @param {string=} options.userPassword - User password (for encrypted files).
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfToText(file, outputFile, options = {}) {
const acceptedOptions = {
Expand Down Expand Up @@ -1491,7 +1491,7 @@ class Poppler {
* @param {string} outputFile - Filepath of the file to output the resulting merged PDF to.
* @param {object=} options - Object containing options to pass to binary.
* @param {boolean=} options.printVersionInfo - Print copyright and version information.
* @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
*/
async pdfUnite(files, outputFile, options = {}) {
const acceptedOptions = {
Expand Down

0 comments on commit 00a78d8

Please sign in to comment.