{"id":15066551,"url":"https://github.com/danchitnis/comport","last_synced_at":"2025-04-10T13:43:23.651Z","repository":{"id":36931190,"uuid":"230701140","full_name":"danchitnis/ComPort","owner":"danchitnis","description":"A simple package for using W3C Serial Api","archived":false,"fork":false,"pushed_at":"2022-11-10T04:28:17.000Z","size":228,"stargazers_count":5,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T22:05:12.848Z","etag":null,"topics":["api","arduino","browser","chrome","com","communication","comport","edge","embedded","ftdi","hardware","javascript","microbit","microcontroller","port","serial","typescript","w3c"],"latest_commit_sha":null,"homepage":"https://danchitnis.github.io/Serial-API-Examples/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danchitnis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-29T04:12:23.000Z","updated_at":"2024-09-02T17:01:16.000Z","dependencies_parsed_at":"2023-01-17T07:18:30.987Z","dependency_job_id":null,"html_url":"https://github.com/danchitnis/ComPort","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danchitnis%2FComPort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danchitnis%2FComPort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danchitnis%2FComPort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danchitnis%2FComPort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danchitnis","download_url":"https://codeload.github.com/danchitnis/ComPort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248226334,"owners_count":21068184,"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":["api","arduino","browser","chrome","com","communication","comport","edge","embedded","ftdi","hardware","javascript","microbit","microcontroller","port","serial","typescript","w3c"],"created_at":"2024-09-25T01:09:10.497Z","updated_at":"2025-04-10T13:43:23.633Z","avatar_url":"https://github.com/danchitnis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ComPort\n\nA simple package to use the new [Serial Api](https://wicg.github.io/serial/) available in Chrome (also Edge based on Chromium)\n\n🔥 **Notice** : Serial Api is under Chrome's experimental flag since Chrome 79 and on Origins Trail since Chrome 80. The API is unstable.\n\n## Why Serial Api\n\nAlthough [WebUSB](https://wicg.github.io/webusb/) has been around for some years, it is mainly targeted at companies intending to developed web-based firmwares. A major downside of WebUSB is once a native driver is installed on the OS, the device will no longer be recognized by WebUSB. Unlike WebUSB, the [Serial Api](https://wicg.github.io/serial/) is intended for use as a traditional COM port (Serial port) which includes many microcontroller based devices and USB-to-Serial devices such as FTDI and Cypress chipsets. Additionally, you can still implement your own USB CDC protocol, and have the OS driver and Web driver co-exist. The Serial Api opens doors for new and exciting web-based front-ends for small and medium sized embedded projects.\n\n## Why ComPort\n\nComPort makes it easy for embedded developers to quickly build a modern front-end for their applications. It removes the hassle of dealing with async/await functions. This package is not intended for high-performance and high data-rate applications, but for quick and simple development. If high-performance is required then a browser based app is probably the wrong choice.\n\n## Potential use cases\n\nall serial communication to and from embedded hardware via USB-to-Serial bridges like FTDI cables and Arduino boards.\n\n## How to enable Serial Api (Chrome 79 and above)\n\nEnable it in: chrome://flags/#enable-experimental-web-platform-features\n\n## Build instructions\n\n```bash\nnpm i\nnpm run build\n```\n\n## installation\n\n```bash\nnpm i @danchitnis/comport\n```\n\n## Example\n\nimport the library\n\n```javascript\nimport { ComPort } from \"@danchitnis/ComPort\";\n```\n\ninitialize:\n\n```javascript\nconst port = new ComPort();\nport.connect(9600);\nport.addEventListener(\"rx\", dataRX);\n```\n\ndata RX event:\n\n```javascript\nfunction dataRX(e) {\n  log(e.detail + \"\\n\");\n}\n```\n\n## API documentation\n\n[See here 🧾](https://danchitnis.github.io/ComPort/)\n\n## Demos\n\nSee [here](https://github.com/danchitnis/Serial-API-Examples) examples tested with [Arduino Nano 33 BLE](https://store.arduino.cc/arduino-nano-33-ble), but also extendable to other boards as it is simply using serial communication.\n\n## Useful links\n\n- [W3C Serial Api working draft](https://wicg.github.io/serial/)\n- [Serial Api Chrome status](https://www.chromestatus.com/feature/6577673212002304)\n- [Google Serial Api example](https://codelabs.developers.google.com/codelabs/web-serial/#0)\n- [Serial Api Explainer](https://github.com/WICG/serial/blob/gh-pages/EXPLAINER.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanchitnis%2Fcomport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanchitnis%2Fcomport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanchitnis%2Fcomport/lists"}