Skip to content

Commit

Permalink
chore: remove no longer needed node-fetch
Browse files Browse the repository at this point in the history
test: test urls fetching only if fetch is available

chore: code clean-up

test: test urls fetching only if fetch is available
  • Loading branch information
mojoaxel committed Jan 27, 2024
1 parent 07b55af commit 585f3b3
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7,661 deletions.
2 changes: 1 addition & 1 deletion PDFMergerBase.js
Expand Up @@ -163,7 +163,7 @@ export default class PDFMergerBase {
// see https://developer.mozilla.org/en-US/docs/Web/API/URL
if (input instanceof URL) {
if (typeof fetch === 'undefined') {
throw new Error('fetch is not defined. You need to use a polyfill for this to work in Node.js.')
throw new Error('fetch is not defined. You need to use a polyfill for this to work.')
}
const res = await fetch(input)
const aBuffer = await res.arrayBuffer()
Expand Down
7 changes: 3 additions & 4 deletions README.md
Expand Up @@ -4,8 +4,7 @@ This node.js library can **merge multiple PDF documents**, or parts of them, to

## Legacy notes

* If you are searching for the legacy version based on
[pdfjs](https://www.npmjs.com/package/pdfjs) please install a [v3 release](https://github.com/nbesli/pdf-merger-js/releases?q=v3&expanded=true). Since [v4](https://github.com/nbesli/pdf-merger-js/releases?q=v4&expanded=true) we use [pdf-lib](https://pdf-lib.js.org/) instead.
* If you are searching for the legacy version based on [pdfjs](https://www.npmjs.com/package/pdfjs) please install a [v3 release](https://github.com/nbesli/pdf-merger-js/releases?q=v3&expanded=true). Since [v4](https://github.com/nbesli/pdf-merger-js/releases?q=v4&expanded=true) we use [pdf-lib](https://pdf-lib.js.org/) instead.
* If you are searching for a legacy version using CommonJS modules please install a [v4 release](https://github.com/nbesli/pdf-merger-js/releases?q=v4&expanded=true). Since [v5](https://github.com/nbesli/pdf-merger-js/releases?q=v5&expanded=true) we use the modern ESM ("import") instead of the CommonJS ("require) module standard.

This library is inspired by the [PHP library PDFMerger](https://github.com/myokyawhtun/PDFMerger) and has a very similar API.
Expand All @@ -14,15 +13,15 @@ This library is inspired by the [PHP library PDFMerger](https://github.com/myoky

`npm install --save pdf-merger-js`

of global installation if you want to use the cli tool:
or global installation if you just want to use the cli tool:

`npm install -g pdf-merger-js`

## Usage

### CLI

```
```txt
Options:
-V, --version output the version number
-o, --output <outputFile> Merged PDF output file path
Expand Down

0 comments on commit 585f3b3

Please sign in to comment.