MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / pngSize

Function pngSize

scripts/integration/webrtc.mjs:372–385  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

370}
371
372function pngSize(filePath) {
373 const buffer = fs.readFileSync(filePath);
374 if (
375 buffer.length < 24 ||
376 buffer.readUInt32BE(0) !== 0x89504e47 ||
377 buffer.readUInt32BE(4) !== 0x0d0a1a0a
378 ) {
379 throw new Error(`${filePath} is not a PNG file`);
380 }
381 return {
382 width: buffer.readUInt32BE(16),
383 height: buffer.readUInt32BE(20),
384 };
385}
386
387function killPortListeners(port) {
388 const result = spawnSync("lsof", ["-ti", `tcp:${port}`], {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected