UNPKG

@tomatrow/pdf-to-png-converter

Version:

Node.js utility to convert PDF file/buffer pages to PNG files/buffers with no native dependencies.

21 lines (20 loc) 628 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizePath = normalizePath; const node_path_1 = require("node:path"); function normalizePath(path) { if (path === '') { throw new Error('Path cannot be empty'); } const resolvedPath = ((0, node_path_1.normalize)((0, node_path_1.resolve)(path))); if (process.platform === 'win32') { if (resolvedPath.endsWith('\\')) { return resolvedPath; } return `${resolvedPath}\\`; } if (resolvedPath.endsWith('/')) { return resolvedPath; } return `${resolvedPath}/`; }