Socket
Socket
Sign inDemoInstall

pdf-to-png-converter

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdf-to-png-converter - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

11

out/compare.png.js

@@ -8,14 +8,11 @@ "use strict";

const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const png_visual_compare_1 = __importDefault(require("png-visual-compare"));
const path_1 = require("path");
const node_fs_2 = require("node:fs");
function comparePNG(actualFilePathOrBuffer, expectedFilePath, opts) {
if (!(0, node_fs_1.existsSync)(expectedFilePath)) {
const expectedFileDir = (0, path_1.parse)(expectedFilePath).dir;
const expectedFileDir = (0, node_path_1.parse)(expectedFilePath).dir;
if (!(0, node_fs_1.existsSync)(expectedFileDir)) {
(0, node_fs_2.mkdirSync)(expectedFileDir, { recursive: true });
(0, node_fs_1.mkdirSync)(expectedFileDir, { recursive: true });
}
const actualBuffer = typeof actualFilePathOrBuffer === 'string'
? (0, node_fs_1.readFileSync)(actualFilePathOrBuffer)
: actualFilePathOrBuffer;
const actualBuffer = typeof actualFilePathOrBuffer === 'string' ? (0, node_fs_1.readFileSync)(actualFilePathOrBuffer) : actualFilePathOrBuffer;
(0, node_fs_1.writeFileSync)(expectedFilePath, actualBuffer);

@@ -22,0 +19,0 @@ }

@@ -12,8 +12,5 @@ "use strict";

const isBuffer = Buffer.isBuffer(pdfFilePathOrBuffer);
if (!isBuffer && !(0, node_fs_1.existsSync)(pdfFilePathOrBuffer)) {
throw Error(`PDF file not found on: ${pdfFilePathOrBuffer}.`);
}
const pdfFileBuffer = isBuffer
? pdfFilePathOrBuffer
: (0, node_fs_1.readFileSync)(pdfFilePathOrBuffer);
: await node_fs_1.promises.readFile(pdfFilePathOrBuffer);
const pdfDocInitParams = (0, props_to_pdf_doc_init_params_1.propsToPdfDocInitParams)(props);

@@ -33,4 +30,4 @@ pdfDocInitParams.data = new Uint8Array(pdfFileBuffer);

}
if (props?.outputFolder && !(0, node_fs_1.existsSync)(props.outputFolder)) {
(0, node_fs_1.mkdirSync)(props.outputFolder, { recursive: true });
if (props?.outputFolder) {
await node_fs_1.promises.mkdir(props.outputFolder, { recursive: true });
}

@@ -76,6 +73,7 @@ let pageName;

pngPageOutput.path = (0, node_path_1.resolve)(props.outputFolder, pngPageOutput.name);
(0, node_fs_1.writeFileSync)(pngPageOutput.path, pngPageOutput.content);
await node_fs_1.promises.writeFile(pngPageOutput.path, pngPageOutput.content);
}
pngPagesOutput.push(pngPageOutput);
}
await pdfDocument.cleanup();
return pngPagesOutput;

@@ -82,0 +80,0 @@ }

{
"name": "pdf-to-png-converter",
"version": "3.0.0",
"version": "3.1.0",
"description": "Node.js utility to convert PDF file/buffer pages to PNG files/buffers with no native dependencies.",

@@ -44,17 +44,17 @@ "keywords": [

"canvas": "^2.11.2",
"pdfjs-dist": "^3.5.141"
"pdfjs-dist": "^3.8.162"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"eslint": "^8.38.0",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.3",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"png-visual-compare": "^1.2.0",
"rimraf": "^4.4.1",
"ts-jest": "^29.1.0",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc