Make FS paths configurable

This commit is contained in:
Alex Gleason committed 2025-10-23 14:50:05 -05:00
1 parent f89a481c9c
commit d75bd386aa
43 files changed
+393 -124

No files matched your search

+4 -3
View File
@@ -46,13 +46,14 @@ export async function generateUniqueFilename(
}
/**
* Save a file to the /tmp directory with deduplication
* Save a file to the tmp directory with deduplication
* @param fs - Filesystem instance
* @param file - File object to save
* @param tmpPath - Custom tmp path (default: /tmp)
* @returns Promise<string> - Full path where the file was saved
*/
export async function saveFileToTmp(fs: JSRuntimeFS, file: File): Promise<string> {
const tmpDir = '/tmp';
export async function saveFileToTmp(fs: JSRuntimeFS, file: File, tmpPath = '/tmp'): Promise<string> {
const tmpDir = tmpPath;
// Convert spaces to underscores in the filename
const sanitizedFilename = file.name.replace(/\s+/g, '_');
const uniqueFilename = await generateUniqueFilename(fs, tmpDir, sanitizedFilename);