Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
pdfactory-core
Advanced tools
- Generate pdf documents from html files. - Generate dynamic pdf documents using ejs files as templates.
yarn add pdfactory-code
/main.js
/templates
/partials
/page1.ejs
/document.ejs
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div>
<%- include('./partials/page1.ejs'); -%>
</div>
</body>
</html>
<div>
<%= title %>
</div>
const express = require("express");
const path = require("path");
const { pdfactory } = require("pdfactory-core");
const templatesDir = path.join(__dirname, "templates");
const partialsDir = path.join(__dirname, "templates", "partials");
const DEFAULT_CONFIG = {
templatesDir: [templatesDir, partialsDir],
ejsOptions: {
views: [templatesDir], // For relative include paths
},
};
const init = async () => {
const pdfactoryHandler = await pdfactory(DEFAULT_CONFIG);
const app = express();
app.use(express.json());
const requestHandler = async (req, res) => {
let pdf = null;
try {
pdf = await pdfactoryHandler(req.body)
} catch (e) {
res.status(400).send(e)
return
}
res.set({
"Content-Type": "application/pdf",
"Content-Length": pdf.length,
});
res.send(pdf);
};
app.post("/", requestHandler);
app.listen(3000);
return app;
};
init();
POST https://localhost:3000
{
"document": "document",
"data": {
"title": "pdfactory pdf"
}
}
FAQs
- Generate pdf documents from html files. - Generate dynamic pdf documents using ejs files as templates.
We found that pdfactory-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.