UNPKG

@composio/core

Version:

![Composio Banner](https://github.com/user-attachments/assets/9ba0e9c1-85a4-4b51-ae60-f9fe7992e819)

36 lines (34 loc) 1.28 kB
//#region src/platform/workerd.ts /** * Cloudflare Workers / Edge runtime platform implementation. * Provides stub implementations for file system operations that are unavailable in edge runtimes. * All file system operations gracefully return null/empty values or throw descriptive errors. */ const platform = { supportsFileSystem: false, homedir() { return null; }, joinPath(...paths) { return paths.map((segment, index) => { if (index === 0) return segment.replace(/\/+$/, ""); return segment.replace(/^\/+|\/+$/g, ""); }).filter(Boolean).join("/"); }, basename(filePath) { const segments = filePath.replace(/\/+$/, "").split("/"); return segments[segments.length - 1] || ""; }, existsSync(_filePath) { return false; }, mkdirSync(_dirPath) {}, readFileSync(_filePath, _encoding) { throw new Error("File system operations are not supported in this runtime environment (Cloudflare Workers/Edge). Use environment variables or external storage services instead."); }, writeFileSync(_filePath, _content, _encoding) { throw new Error("File system operations are not supported in this runtime environment (Cloudflare Workers/Edge). Use environment variables or external storage services instead."); } }; //#endregion exports.platform = platform;