Skip to content

Commit

Permalink
fix: Blob might be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
mojoaxel committed Jan 27, 2024
1 parent 42b0302 commit 4d6816c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 113 deletions.
2 changes: 1 addition & 1 deletion PDFMergerBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default class PDFMergerBase {
}

// see https://developer.mozilla.org/en-US/docs/Web/API/Blob
if (input instanceof Blob) {
if (Blob && input instanceof Blob) {
const aBuffer = await input.arrayBuffer()
return new Uint8Array(aBuffer)
}
Expand Down
109 changes: 0 additions & 109 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"pdf-lib": "^1.17.1"
},
"devDependencies": {
"cross-blob": "^3.0.2",
"fs-extra": "^11.2.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand Down
3 changes: 1 addition & 2 deletions test/PDFMerger.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import path from 'path'

import fs from 'fs-extra'
import Blob from 'cross-blob'
import pdfDiff from 'pdf-diff'
import { PDFDocument } from 'pdf-lib'
import { jest } from '@jest/globals'
Expand Down Expand Up @@ -103,7 +102,7 @@ describe('PDFMerger', () => {
expect(diff).toBeFalsy()
})

test('provide input as Blob', async () => {
(Blob ? test : test.skip)('provide input as Blob', async () => {
const merger = new PDFMerger()
const TestfileAUint8Array = await fs.readFile(path.join(FIXTURES_DIR, 'Testfile_A.pdf'))
const TestfileABlob = new Blob([TestfileAUint8Array])
Expand Down

0 comments on commit 4d6816c

Please sign in to comment.