openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 642 B
JavaScript
import{serialize}from"node:v8";import{readRegularFile}from"@openclaw/fs-safe/advanced";
//!src/agents/sessions/tools/read-file.worker.ts
let result;try{const e=process.argv[2];if(!e)throw new Error(`File read requires a path`);if(process.argv[3]===`page`){const{captureReadFilePage:t}=await import(`../../../read-file-page-DFnz8gpw.mjs`);result=await t(e,JSON.parse(process.argv[4]))}else result={buffer:(await readRegularFile({filePath:e})).buffer}}catch(e){result={error:e instanceof Error?e:new Error(String(e)),...e instanceof Error&&`code`in e&&typeof e.code===`string`?{code:e.code}:{}}}process.stdout.write(serialize(result));export{};