@shelf/aws-lambda-libreoffice
Version:
Utility to work with Docker version of LibreOffice in Lambda
15 lines (14 loc) • 468 B
JavaScript
import fs from 'fs/promises';
import { deleteAsync } from 'del';
// Removes temp files generated by LibreOffice
export async function cleanupTempFiles() {
const files = await fs.readdir(`/tmp`);
for (const file of files) {
if (file.endsWith('.tmp') === true || file.startsWith('OSL_PIPE')) {
try {
await deleteAsync([`/tmp/${file}`, `/tmp/${file}/*`], { force: true });
}
catch { }
}
}
}