UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 893 B
import{x as root}from"./fs-safe-Bxzu1j4h.mjs";import{t as _usingCtx}from"./usingCtx-CUVyQ_FT.mjs";import{o as readFileHandleBounded}from"./file-access-runtime-Jlxwf1va.mjs";import path from"node:path"; //!extensions/browser/src/browser/extension-native-host-file.ts async function readPrivateNativeHostFile(e,t){try{var n=_usingCtx();const r=path.resolve(e);const i=await root(path.dirname(r));const a=n.a(await i.open(path.basename(r),{hardlinks:`allow`}));if(a.realPath!==r)throw new Error(`unresolved native host file path`);const o=process.getuid?.();if(o!==void 0&&a.stat.uid!==o)throw new Error(`foreign native host file owner`);if((a.stat.mode&63)!==0||t&&(a.stat.mode&64)===0)throw new Error(`native host file has unsafe mode`);return{realPath:a.realPath,buffer:await readFileHandleBounded(a.handle,Infinity)}}catch(e){n.e=e}finally{await n.d()}}export{readPrivateNativeHostFile as t};