Skip to main content
Glama

vulcan-file-ops

pdfmake.js.ts3.12 kB
/** * Mock for pdfmake/build/pdfmake.js module * * This mock allows tests to run without loading the problematic pdfmake ESM module. */ interface PdfMakeDocument { getBuffer(callback: (buffer: Buffer) => void): void; getBase64(callback: (base64: string) => void): void; download(defaultFileName?: string): void; open(): void; print(): void; } interface PdfMakeStatic { vfs?: any; fonts?: any; createPdf( documentDefinition: any, tableLayouts?: any, fonts?: any, vfs?: any ): PdfMakeDocument; } // Create a mock PDF buffer that starts with %PDF (valid PDF header) // Makes it substantial enough to pass size checks (> 1000 bytes) function createMockPdfBuffer(): Buffer { const pdfHeader = Buffer.from("%PDF-1.4\n"); // Create a more substantial mock PDF body with typical PDF objects const pdfObjects = Buffer.from(` 1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj 2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> endobj 3 0 obj << /Type /Page /Parent 2 0 R /Resources 4 0 R /Contents 5 0 R >> endobj 4 0 obj << /Font << /F1 << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> >> >> endobj 5 0 obj << /Length 400 >> stream BT /F1 12 Tf 50 700 Td (This is a mock PDF document generated for testing purposes.) Tj 0 -20 Td (It contains multiple lines of text to ensure the buffer size) Tj 0 -20 Td (is substantial enough to pass size validation tests.) Tj 0 -20 Td (The document includes typical PDF structure elements and formatting.) Tj 0 -20 Td (Additional content is added here to ensure the PDF buffer exceeds) Tj 0 -20 Td (the minimum size threshold of 1000 bytes required by the test suite.) Tj 0 -20 Td (This mock PDF simulates a real pdfmake-generated document structure.) Tj 0 -20 Td (It includes proper PDF syntax with objects, streams, and metadata.) Tj 0 -20 Td (The content is verbose enough to meet size requirements.) Tj 0 -20 Td (This ensures compatibility with all PDF validation tests.) Tj ET endstream endobj xref 0 6 0000000000 65535 f 0000000010 00000 n 0000000060 00000 n 0000000120 00000 n 0000000210 00000 n 0000000310 00000 n trailer << /Size 6 /Root 1 0 R >> startxref 600 `); const pdfFooter = Buffer.from("\n%%EOF\n"); return Buffer.concat([pdfHeader, pdfObjects, pdfFooter]); } const pdfMake: PdfMakeStatic = { vfs: {}, fonts: {}, createPdf: ( documentDefinition: any, tableLayouts?: any, fonts?: any, vfs?: any ): PdfMakeDocument => { return { getBuffer: (callback: (buffer: Buffer) => void) => { // Simulate async PDF generation setTimeout(() => { callback(createMockPdfBuffer()); }, 10); }, getBase64: (callback: (base64: string) => void) => { setTimeout(() => { callback(createMockPdfBuffer().toString("base64")); }, 10); }, download: (defaultFileName?: string) => { // Mock download - do nothing in tests }, open: () => { // Mock open - do nothing in tests }, print: () => { // Mock print - do nothing in tests }, }; }, }; export default pdfMake;

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/n0zer0d4y/vulcan-file-ops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server