{"id":24616241,"url":"https://github.com/benoitlahoz/node-syphon","last_synced_at":"2025-08-31T16:39:28.433Z","repository":{"id":274059053,"uuid":"671913856","full_name":"benoitlahoz/node-syphon","owner":"benoitlahoz","description":"Experimental and superficial wrapper of Syphon-Framework for node.js.","archived":false,"fork":false,"pushed_at":"2025-03-02T22:02:25.000Z","size":4249,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T23:18:21.982Z","etag":null,"topics":["electron","iosurface","ipc","nodejs","syphon","video"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benoitlahoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-28T12:38:23.000Z","updated_at":"2025-02-26T08:50:13.000Z","dependencies_parsed_at":"2025-01-24T16:35:20.389Z","dependency_job_id":"21eb6741-b3ba-428b-a9ba-24531ae03b1a","html_url":"https://github.com/benoitlahoz/node-syphon","commit_stats":null,"previous_names":["benoitlahoz/node-syphon"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitlahoz%2Fnode-syphon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitlahoz%2Fnode-syphon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitlahoz%2Fnode-syphon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitlahoz%2Fnode-syphon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benoitlahoz","download_url":"https://codeload.github.com/benoitlahoz/node-syphon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244290286,"owners_count":20429338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","iosurface","ipc","nodejs","syphon","video"],"created_at":"2025-01-24T22:16:31.038Z","updated_at":"2025-08-31T16:39:28.428Z","avatar_url":"https://github.com/benoitlahoz.png","language":"TypeScript","funding_links":["https://www.paypal.com/donate/?hosted_button_id=C2ABZ3KBUXF92"],"categories":[],"sub_categories":[],"readme":"# node-syphon\n\nSuperficial bindings between [`Syphon-Framework`](https://github.com/Syphon/Syphon-Framework) and `node.js`, that supports both Intel and Silicon architectures.\n\n`node-syphon` provides Javascript functions to handle publishing and subcribing to Syphon textures in OpenGL and Metal as:\n\n- Pixel buffers/arrays (`Uint8Array`).\n- IOSurface handles in Electron (publish only, subscribing is ready and tested but waiting for the approval of [this Electron PR](https://github.com/electron/electron/pull/46811)).\n\n## Donate / Sponsor\n\nIf you find this package useful, contribute to the author's open source work by donating here! Thank you!\n\n[![paypal](https://img.shields.io/badge/contribute-Paypal-2ea44f)](https://www.paypal.com/donate/?hosted_button_id=C2ABZ3KBUXF92)\n\n## Table of Contents\n\n- [node-syphon](#node-syphon)\n  - [Donate / Sponsor](#donate--sponsor)\n  - [Table of Contents](#table-of-contents)\n  - [Install](#install)\n  - [Examples](#examples)\n  - [Usage](#usage)\n    - [Client](#client)\n    - [Server](#server)\n        - [OpenGL](#opengl)\n        - [Metal](#metal)\n  - [Contribute](#contribute)\n  - [Performances](#performances)\n  - [TODO](#todo)\n\n## Install\n\n```sh\nyarn add node-syphon\n```\n\n## Examples\n\n- [Command line examples](https://github.com/benoitlahoz/node-syphon-cli-examples)\n- [Electron pixel data \u0026 shared texture handle](https://github.com/benoitlahoz/node-syphon-electron-example)\n\n## Usage\n\n### Client\n\n```typescript\nimport {\n  SyphonOpenGLClient,\n  SyphonServerDirectory,\n  SyphonServerDirectoryListenerChannel,\n} from 'node-syphon';\n\nconst directory = new SyphonServerDirectory();\n\ndirectory.on(\n  SyphonServerDirectoryListenerChannel.SyphonServerAnnounceNotification,\n  (server: any) =\u003e {\n    console.log('Server announce', server);\n\n    if (directory.servers.length \u003e 0 \u0026\u0026 !client) {\n      console.log('Create');\n\n      client = new SyphonOpenGLClient(directory.servers[directory.servers.length - 1]);\n\n      client.on('frame', (frame: FrameDataDefinition) =\u003e {\n        console.log('Frame received', frame);\n\n        const buffer: Buffer = frame.buffer;\n        const width: number = frame.width;\n        const height: number = frame.height;\n\n        // ...\n      });\n    }\n  }\n);\n\ndirectory.on(SyphonServerDirectoryListenerChannel.SyphonServerRetireNotification, (server: any) =\u003e {\n  console.log('Server retire', server);\n  console.log(directory.servers);\n});\n\ndirectory.listen();\n```\n\n### Server\n\n##### OpenGL\n\n```typescript\nimport { SyphonOpenGLServer } from 'node-syphon';\n\n// Create a server.\nconst server = new SyphonOpenGLServer('My awesome server');\n\nconst size = 50 * 50 * 4;\nconst clamp = 255;\n\nlet data: any = new Uint8ClampedArray(size);\n\n// Generate random pixels.\nfor (let i = 0; i \u003c size; i = i + 4) {\n  data[i] = Math.floor(Math.random() * Math.min(255, clamp));\n  data[i + 1] = Math.floor(Math.random() * Math.min(255, clamp));\n  data[i + 2] = Math.floor(Math.random() * Math.min(255, clamp));\n  data[i + 3] = 255;\n}\n\n// Send frames.\nconst interval = setInterval(() =\u003e {\n  server.publishImageData(\n    data,\n\n    // Region.\n\n    { x: 0, y: 0, width: 50, height: 50 },\n\n    // Texture dimensions.\n\n    { width: 50, height: 50 },\n\n    // Flipped.\n\n    false,\n\n    // Texture target (defaults to 'GL_RECTANGLE_EXT').\n\n    'GL_TEXTURE_2D'\n  );\n}, 1000 / 60);\n```\n\n##### Metal\n\n```typescript\nimport { SyphonMetalServer } from 'node-syphon';\n\n// Create a server.\nconst server = new SyphonMetalServer('My awesome server');\n\nconst size = 50 * 50 * 4;\nconst clamp = 255;\n\nlet data: any = new Uint8ClampedArray(size);\n\n// Generate random pixels.\nfor (let i = 0; i \u003c size; i = i + 4) {\n  data[i] = Math.floor(Math.random() * Math.min(255, clamp));\n  data[i + 1] = Math.floor(Math.random() * Math.min(255, clamp));\n  data[i + 2] = Math.floor(Math.random() * Math.min(255, clamp));\n  data[i + 3] = 255;\n}\n\n// Send frames.\nconst interval = setInterval(() =\u003e {\n  server.publishImageData(\n    data,\n\n    // Region.\n\n    { x: 0, y: 0, width: 50, height: 50 },\n\n    // Texture dimensions.\n\n    { width: 50, height: 50 },\n\n    // Flipped.\n\n    false\n  );\n}, 1000 / 60);\n```\n\n## Contribute\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md)\n\n## Performances\n\nAs of v0.6.1, the `electron` **client** example getting a **1920x1080** image from VDMX has a latency of **8 milliseconds** on a MacPro 2013.\n\n## TODO\n\n- [ ] Test the server description NSImage-\u003eNapi::Buffer.\n- [ ] Experiment WebGPU Native to and from Browser.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitlahoz%2Fnode-syphon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenoitlahoz%2Fnode-syphon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitlahoz%2Fnode-syphon/lists"}