UNPKG

agent-device

Version:

Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.

1 lines • 406 B
import{v as e}from"./sdk-contracts.js";import{promises as t}from"node:fs";async function n(n){let r=await t.open(n,`r`);try{let t=Buffer.alloc(24),{bytesRead:n}=await r.read(t,0,t.length,0);if(n<t.length||t.toString(`ascii`,12,16)!==`IHDR`)throw new e(`COMMAND_FAILED`,`Screenshot file is not a valid PNG`);return{width:t.readUInt32BE(16),height:t.readUInt32BE(20)}}finally{await r.close()}}export{n as t};