Serverless & Edge Compatibility
Runtime Compatibility Matrix
Pure JavaScript OpenXML parsing with zero native binary dependencies (no Microsoft Office, no LibreOffice, no Java VM, no Electron, no node-gyp).
Supported Runtimes & Environments
| Environment / Runtime | Status | Cold Boot | Package Size | Details |
|---|---|---|---|---|
| Node.js (>= 18, 20.x, 22.x, 24.x) | Fully Supported | < 15ms | < 2MB | Full support for CJS (require) and ESM (import) with native TypeScript definitions (.d.ts). High-performance in-memory Virtual File System. |
| AWS Lambda (Node.js 18 / 20 / 22) | Fully Supported | < 25ms | < 2MB | Instant cold-start execution without disk writes. Export directly via ppt.toBuffer() or stream to S3 buckets. |
| Cloudflare Workers (V8 Isolates) | Fully Supported | < 5ms | < 2MB | Zero Node.js fs dependencies. Ingest from web streams or ArrayBuffer, export via ppt.toArrayBuffer() directly to HTTP responses. |
| Vercel Edge & Serverless Functions | Fully Supported | < 20ms | < 2MB | Compatible with Next.js App Router route handlers (app/api/generate/route.js). Zero temporary file disk pollution. |
| Bun (>= 1.0) | Fully Supported | < 10ms | < 2MB | High-throughput execution leveraging Bun fast ZIP and Buffer APIs. |
| Deno (>= 1.38) | Supported via npm: specifier | < 25ms | < 2MB | Usable via import { PPTXTemplater } from 'npm:node-pptx-templater'. |
Production Guarantees
Zero Office / Electron Daemon
Unlike unoconv, LibreOffice, or Puppeteer, node-pptx-templater does not launch background daemons or require 500MB+ Docker containers.
In-Memory Virtual File System
Operates 100% in RAM via Map<string, Uint8Array>. Eliminates /tmp write contention, disk IOPS costs, and concurrency race conditions.
XXE & Security Guardrails
Built-in protection against XML External Entity (XXE) and Billion Laughs exponential entity expansion attacks via strict parser configuration.
Office Repair Warning Prevention
Synchronous DrawingML and embedded Excel workbook cache updating guarantees slides open cleanly without Microsoft PowerPoint repair prompts.
Deployment Recipes
AWS Lambda: S3 Streaming & In-Memory Buffer
lambda-handler.mjs
import { PPTXTemplater } from 'node-pptx-templater';
import { S3Client, GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3';
const s3 = new S3Client({ region: 'us-east-1' });
export const handler = async (event) => {
// 1. Fetch template buffer from S3 bucket
const s3Res = await s3.send(new GetObjectCommand({
Bucket: 'company-templates',
Key: 'executive-summary.pptx'
}));
const templateBuffer = Buffer.from(await s3Res.Body.transformToByteArray());
// 2. Load into memory (zero /tmp disk I/O)
const ppt = await PPTXTemplater.load(templateBuffer);
ppt.useSlide(1).replaceText(event.replacements);
// 3. Export directly as Node.js Buffer
const outputBuffer = await ppt.toBuffer();
// 4. Save generated deck to output bucket
await s3.send(new PutObjectCommand({
Bucket: 'company-reports',
Key: `reports/${event.reportId}.pptx`,
Body: outputBuffer,
ContentType: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
}));
return { statusCode: 200, body: JSON.stringify({ success: true }) };
};Cloudflare Workers: V8 Isolate Streaming
worker.js
import { PPTXTemplater } from 'node-pptx-templater';
export default {
async fetch(request, env) {
// 1. Fetch template from CDN or R2 bucket
const res = await fetch('https://cdn.example.com/templates/invoice.pptx');
const arrayBuffer = await res.arrayBuffer();
// 2. Load in V8 isolate memory (no Node.js fs required)
const ppt = await PPTXTemplater.load(arrayBuffer);
ppt.useSlide(1).replaceText({ '{{CLIENT}}': 'Acme Global Corp' });
// 3. Export ArrayBuffer directly to HTTP stream response
const outputArrayBuffer = await ppt.toArrayBuffer();
return new Response(outputArrayBuffer, {
headers: {
'Content-Type': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'Content-Disposition': 'attachment; filename="Invoice.pptx"'
}
});
}
};Next Step
API ReferenceExplore the Complete Methods API Catalog