{"id":15493479,"url":"https://github.com/sinclairzx81/carbon","last_synced_at":"2025-04-22T19:48:20.890Z","repository":{"id":226387611,"uuid":"765507747","full_name":"sinclairzx81/carbon","owner":"sinclairzx81","description":"Compatibility Layer for Node Deno and Bun","archived":false,"fork":false,"pushed_at":"2024-04-29T15:06:46.000Z","size":3035,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-03T08:06:56.706Z","etag":null,"topics":["bun","deno","http","node","websocket"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinclairzx81.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-01T03:46:08.000Z","updated_at":"2024-08-12T08:16:36.000Z","dependencies_parsed_at":"2024-05-03T13:16:30.225Z","dependency_job_id":null,"html_url":"https://github.com/sinclairzx81/carbon","commit_stats":null,"previous_names":["sinclairzx81/carbon"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinclairzx81%2Fcarbon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinclairzx81%2Fcarbon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinclairzx81%2Fcarbon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinclairzx81%2Fcarbon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinclairzx81","download_url":"https://codeload.github.com/sinclairzx81/carbon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250312606,"owners_count":21410067,"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":["bun","deno","http","node","websocket"],"created_at":"2024-10-02T08:07:04.292Z","updated_at":"2025-04-22T19:48:20.869Z","avatar_url":"https://github.com/sinclairzx81.png","language":"TypeScript","readme":"\u003cdiv align='center'\u003e\r\n\r\n\u003ch1\u003eCarbon\u003c/h1\u003e\r\n\r\n\u003cp\u003eCompatibility Layer for Node Deno and Bun\u003c/p\u003e\r\n\r\n\u003cimg src=\"https://github.com/sinclairzx81/carbon/blob/main/carbon.png?raw=true\" /\u003e\r\n\r\n\u003cbr /\u003e\r\n\u003cbr /\u003e\r\n\r\n[![Test](https://github.com/sinclairzx81/carbon/actions/workflows/test.yml/badge.svg)](https://github.com/sinclairzx81/carbon/actions/workflows/test.yml) [![npm version](https://badge.fury.io/js/%40sinclair%2Fcarbon.svg)](https://badge.fury.io/js/%40sinclair%2Fcarbon) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n\u003c/div\u003e\r\n\r\n\r\n## Install\r\n\r\n```bash\r\n$ npm install @sinclair/carbon\r\n```\r\n\r\n## Overview\r\n\r\nCarbon is an experimental cross platform compatibility layer for Node, Deno and Bun.\r\n\r\nLicense MIT\r\n\r\n## Http Server\r\n\r\nThe following starts an Http listener\r\n\r\n```typescript\r\nimport { Http } from '@sinclair/carbon'\r\n\r\nconst listener = await Http.listen({ port: 5000 }, request =\u003e {\r\n\r\n  return new Response('hello world')\r\n})\r\n```\r\n\r\n## WebSocket Server\r\n\r\nThe following upgrades an Http request into a WebSocket\r\n\r\n```typescript\r\nimport { Http } from '@sinclair/carbon'\r\n\r\nconst listener = await Http.listen({ port: 5000 }, request =\u003e {\r\n\r\n  return Http.upgrade(request, socket =\u003e {\r\n\r\n    socket.send('hello world')\r\n  })\r\n})\r\n```\r\n\r\n## Features\r\n\r\nCarbon implements several API abstractions that provide a uniform way to interact with core functionality provided by each runtime. It is built exclusively for ESM and dynamic platform detection + dynamic ESM imports to load implementations for each runtime.\r\n\r\nThe following API's are implemented\r\n\r\n\r\n| Feature         | Info                                    | Node   | Deno   | Bun   | Browser |\r\n| ---             | ---                                     | ---    | ---    | ---   | ---     |\r\n| Ansi            | Ansi Terminal Codes                     | Yes    | Yes    | Yes   | Yes     |\r\n| Assert          | Value Assertions                        | Yes    | Yes    | Yes   | Yes     |\r\n| Async           | Async Utils                             | Yes    | Yes    | Yes   | Yes     |\r\n| Benchmark       | Performance Measurements                | Yes    | Yes    | Yes   | Yes     |\r\n| Buffer          | Operations on Uint8Array Buffers        | Yes    | Yes    | Yes   | Yes     |\r\n| Channel         | Multi Sender Single Receiver Channels   | Yes    | Yes    | Yes   | Yes     |\r\n| Crypto          | Web Crypto API                          | Yes    | Yes    | Yes   | Yes     |\r\n| Encoding        | Json and Binary Buffer Encoding         | Yes    | Yes    | Yes   | Yes     |\r\n| Events          | Event Emitters                          | Yes    | Yes    | Yes   | Yes     |\r\n| Fs              | Isolated File System                    | Yes    | Yes    | Yes   | Yes     |\r\n| Http            | Http and WebSockets                     | Yes    | Yes    | Yes   | Partial |\r\n| Net             | Tcp Listeners and Sockets               | Yes    | Yes    | Yes   | No      |\r\n| Os              | Operating System Resolver               | Yes    | Yes    | Yes   | Yes     |\r\n| Path            | Pathing Utils (Windows and Posix)       | Yes    | Yes    | Yes   | Yes     |\r\n| Performance     | Web Performance API                     | Yes    | Yes    | Yes   | Yes     |\r\n| Process         | Standard IO and TTY                     | Yes    | Yes    | Yes   | Partial |\r\n| Qs              | Query String Parsing                    | Yes    | Yes    | Yes   | Yes     |\r\n| Runtime         | JavaScript Runtime Resolver             | Yes    | Yes    | Yes   | Yes     |\r\n| Stream          | Stream Interfaces                       | Yes    | Yes    | Yes   | Yes     |\r\n| Test            | Unit Testing                            | Yes    | Yes    | Yes   | Yes     |\r\n| Type            | Type System (TypeBox)                   | Yes    | Yes    | Yes   | Yes     |\r\n| Url             | Url Parsing                             | Yes    | Yes    | Yes   | Yes     |\r\n| Value           | Value Operations (TypeBox)              | Yes    | Yes    | Yes   | Yes     |\r\n\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinclairzx81%2Fcarbon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinclairzx81%2Fcarbon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinclairzx81%2Fcarbon/lists"}