Skip to main content
Glama

MCP PDF

output-handler.ts878 B
import { mkdir, writeFile } from 'node:fs/promises'; import { join, resolve } from 'node:path'; /** * Ensure the output directory exists */ export async function ensureOutputDirectory(directory: string): Promise<void> { // Use the async mkdir to avoid blocking the event loop. We still // tolerate the directory already existing. await mkdir(directory, { recursive: true }); } /** * Write PDF buffer to file in sandboxed directory * Returns the full path where the file was written */ export async function writePdfToFile(buffer: Buffer, filename: string, storageDir: string): Promise<{ fullPath: string; storedName: string }> { const outputDir = resolve(storageDir); await ensureOutputDirectory(outputDir); const storedName = filename; const fullPath = join(outputDir, storedName); await writeFile(fullPath, buffer); return { fullPath, storedName }; }

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/mcp-z/mcp-pdf'

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