UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 743 B
import e from"node:fs";import{hasNodeErrorCode as t}from"@openclaw/fs-safe/path";let n=``;process.stdin.setEncoding(`utf8`),process.stdin.on(`data`,e=>{n+=e}),process.stdin.on(`end`,()=>{let{files:r}=JSON.parse(n),i=[],progress=n=>{try{e.writeSync(2,`State schema progress: `+JSON.stringify({phase:`metadata inventory`,path:n})+` `)}catch(e){if(!t(e,`EAGAIN`)&&!t(e,`EWOULDBLOCK`))throw e}};for(let n of r){let r;progress(n);try{r=e.statSync(n,{bigint:!0}).size}catch(e){t(e,`ENOENT`)||i.push({path:n});continue}for(let i of[`-wal`,`-shm`,`-journal`]){progress(n+i);try{r+=e.statSync(n+i,{bigint:!0}).size}catch(e){if(!t(e,`ENOENT`)){r=void 0;break}}}i.push({path:n,sizeBytes:r?.toString()})}process.stdout.write(JSON.stringify(i))});export{};