{"id":30180964,"url":"https://github.com/streamich/libjs","last_synced_at":"2025-08-12T08:06:39.442Z","repository":{"id":66051622,"uuid":"64034251","full_name":"streamich/libjs","owner":"streamich","description":"libc implemented in JavaScript","archived":false,"fork":false,"pushed_at":"2020-07-12T08:41:58.000Z","size":470,"stargazers_count":55,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-01T21:53:51.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2016-07-23T20:12:00.000Z","updated_at":"2025-05-25T06:00:13.000Z","dependencies_parsed_at":"2023-02-22T01:16:28.065Z","dependency_job_id":null,"html_url":"https://github.com/streamich/libjs","commit_stats":{"total_commits":99,"total_committers":1,"mean_commits":99.0,"dds":0.0,"last_synced_commit":"e8528f28a6c0503472eeace1662b2edb8125511c"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/streamich/libjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamich","download_url":"https://codeload.github.com/streamich/libjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270024697,"owners_count":24514054,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-08-12T08:06:19.434Z","updated_at":"2025-08-12T08:06:39.429Z","avatar_url":"https://github.com/streamich.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libjs\n\n[![][npm-badge]][npm-url] [![][travis-badge]][travis-url]\n\nSystem programming library; **libjs** \u0026mdash; [libc](https://en.wikipedia.org/wiki/C_standard_library) in JavaScript.\n\n\n## Usage\n\n```shell\nnpm install libjs libsys\n```\n\nThis library uses [`libsys`](https://github.com/streamich/libsys) to execute system calls from JavaScript.\nIt expects your environment has `libsys` global object, in Node.js you can shim `libsys` as follows:\n\n```js\nrequire('libsys/shim');\n```\n\n\n## Examples\n\n- [Write to console](./docs/examples/write-to-console.md)\n- [Read from a file](./docs/examples/read-file.md)\n- [Run `stat()` on  a file](./docs/examples/stat.md)\n- [TCP *echo* server](./docs/examples/server.md)\n\n\n## Reference\n\n- [Synchronous system calls](./docs/synchronous-system-calls.md)\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n   - __Files__ \u0026mdash; Standard file operations, which operate on most of the Linux/Unix file descriptors.\n      - [`read`](./docs/syscalls/read.md) \u0026mdash; read from a file descriptor.\n      - [`write`](./docs/syscalls/write.md) \u0026mdash; write to a file descriptor.\n      - [`open`](./docs/syscalls/open.md)  \u0026mdash; open a file.\n      - [`close`](./docs/syscalls/close.md) \u0026mdash; close a file descriptor.\n      - [`access`](./docs/syscalls/ADD.md) \u0026mdash; check user can access a file.\n      - [`chmod`](./docs/syscalls/ADD.md) \u0026mdash; change file attributes.\n      - [`fchmod`](./docs/syscalls/ADD.md) \u0026mdash; change file attributes.\n      - [`chown`](./docs/syscalls/ADD.md) \u0026mdash; change file owner.\n      - [`fchown`](./docs/syscalls/ADD.md) \u0026mdash; change file owner.\n      - [`lchown`](./docs/syscalls/ADD.md) \u0026mdash; change file owner.\n      - [`truncate`](./docs/syscalls/ADD.md) \u0026mdash; erase file contents.\n      - [`ftruncate`](./docs/syscalls/ADD.md) \u0026mdash; erase file contents.\n      - [`lseek`](./docs/syscalls/ADD.md) \u0026mdash; change cursor position.\n      - [`rename`](./docs/syscalls/ADD.md) \u0026mdash; rename a file.\n      - [`fsync`](./docs/syscalls/ADD.md) \u0026mdash; flush file to disk.\n      - [`fdatasync`](./docs/syscalls/ADD.md) \u0026mdash; flush file to disk.\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n   - __Stats__ \u0026mdash; Fetches and returns statistics about a file.\n      - [`stat`](./docs/syscalls/ADD.md) \u0026mdash; fetch statistics about a file.\n      - [`lstat`](./docs/syscalls/ADD.md) \u0026mdash; fetch statistics about a file.\n      - [`fstat`](./docs/syscalls/ADD.md) \u0026mdash; fetch statistics about a file.\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n   - __Directories__\n      - [`mkdir`](./docs/syscalls/ADD.md) \u0026mdash; creat a directory.\n      - [`mkdirat`](./docs/syscalls/ADD.md) \u0026mdash; create a directory relative to another directory.\n      - [`rmdir`](./docs/syscalls/ADD.md) \u0026mdash; remove a directory.\n      - [`getcwd`](./docs/syscalls/ADD.md) \u0026mdash; fetch current working directory.\n      - [`getdents64`](./docs/syscalls/ADD.md) \u0026mdash; scan through directory entries.\n      - [`readdir`](./docs/syscalls/ADD.md) \u0026mdash; fetch all folder entries.\n      - [`readdirList`](./docs/syscalls/ADD.md) \u0026mdash; fetch all folder entries.\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n   - __Links__\n      - [`symlink`](./docs/syscalls/ADD.md) \u0026mdash; create a symbolic link.\n      - [`unlink`](./docs/syscalls/ADD.md) \u0026mdash; remove a link.\n      - [`readlink`](./docs/syscalls/ADD.md) \u0026mdash; read value of a symbolic link.\n      - [`link`](./docs/syscalls/ADD.md) \u0026mdash; create a link.\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n   - __Time__\n      - [`utime`](./docs/syscalls/ADD.md) \u0026mdash; change file last access and modification times.\n      - [`utimes`](./docs/syscalls/ADD.md) \u0026mdash; change file last access and modification times.\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n   - __Networking__\n      - [`socket`](./docs/syscalls/ADD.md) \u0026mdash; create a socket file descriptor.\n      - [`connect`](./docs/syscalls/ADD.md) \u0026mdash; initiate a connection on a socket.\n      - [`bind`](./docs/syscalls/ADD.md) \u0026mdash; assign an address to a socket.\n      - [`listen`](./docs/syscalls/ADD.md) \u0026mdash; listen for new connections on a socket.\n      - [`accept`](./docs/syscalls/ADD.md) \u0026mdash; accept a connection on a socket.\n      - [`accept4`](./docs/syscalls/ADD.md) \u0026mdash; accept a connection on a socket.\n      - [`shutdown`](./docs/syscalls/ADD.md) \u0026mdash; shut down all or part of a full-duplex connection.\n      - [`send`](./docs/syscalls/ADD.md) \u0026mdash; write data to a socket file descriptor.\n      - [`sendto`](./docs/syscalls/ADD.md) \u0026mdash; write data to a socket file descriptor.\n      - [`recv`](./docs/syscalls/ADD.md) \u0026mdash; read data from socket file descriptor.\n      - [`recvfrom`](./docs/syscalls/ADD.md) \u0026mdash; read data from socket file descriptor.\n      - [`setsockopt`](./docs/syscalls/ADD.md) \u0026mdash; get and set options on a socket.\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n   - __Process__\n      - [`getpid`](./docs/syscalls/ADD.md) \u0026mdash; fetch process *id*.\n      - [`getppid`](./docs/syscalls/ADD.md) \u0026mdash; fetch process *id*.\n      - [`getuid`](./docs/syscalls/ADD.md) \u0026mdash; fetch user *id*.\n      - [`geteuid`](./docs/syscalls/ADD.md) \u0026mdash; fetch user *id*.\n      - [`getgid`](./docs/syscalls/ADD.md) \u0026mdash; fetch group *id*.\n      - [`getegid`](./docs/syscalls/ADD.md) \u0026mdash; fetch group *id*.\n      - [`sched_yield`](./docs/syscalls/ADD.md) \u0026mdash; yield execution to another thread.\n      - [`nanosleep`](./docs/syscalls/ADD.md) \u0026mdash; put thread to sleep.\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n   - __Events__\n      - [`fcntl`](./docs/syscalls/ADD.md) \u0026mdash; manipulate file descriptor.\n      - [`epoll_create`](./docs/syscalls/ADD.md) \u0026mdash; create an *epoll* file descriptor.\n      - [`epoll_create1`](./docs/syscalls/ADD.md) \u0026mdash; create an *epoll* file descriptor.\n      - [`epoll_wait`](./docs/syscalls/ADD.md) \u0026mdash; fetch *epoll* events.\n      - [`epoll_ctl`](./docs/syscalls/ADD.md) \u0026mdash; control interface for an epoll file descriptor. \n      - [`inotify_init`](./docs/syscalls/ADD.md)\n      - [`inotify_init1`](./docs/syscalls/ADD.md)\n      - [`inotify_add_watch`](./docs/syscalls/ADD.md)\n      - [`inotify_rm_watch`](./docs/syscalls/ADD.md)\n      - [`kqueue`](./docs/syscalls/ADD.md)\n      - [`kevent`](./docs/syscalls/ADD.md)\n      - [`EV_SET`](./docs/syscalls/ADD.md)\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n   - __Memory__\n      - [`mmap`](./docs/syscalls/ADD.md)\n      - [`munmap`](./docs/syscalls/ADD.md)\n      - [`mprotect`](./docs/syscalls/ADD.md)\n      - [`shmget`](./docs/syscalls/ADD.md)\n      - [`shmat`](./docs/syscalls/ADD.md)\n      - [`shmdt`](./docs/syscalls/ADD.md)\n      - [`shmctl`](./docs/syscalls/ADD.md)\n        \u003cbr/\u003e\n        \u003cbr/\u003e\n- Asynchronous system calls\n   - __Files__: [`readAsync`](./docs/syscalls/readAsync.md),\n     [`writeAsync`](./docs/syscalls/writeAsync.md),\n     [`openAsync`](./docs/syscalls/openAsync.md),\n     [`closeAsync`](./docs/syscalls/closeAsync.md),\n     [`accessAsync`](./docs/syscalls/ADD.md),\n     [`chmodAsync`](./docs/syscalls/ADD.md),\n     [`fchmodAsync`](./docs/syscalls/ADD.md),\n     [`chownAsync`](./docs/syscalls/ADD.md),\n     [`fchownAsync`](./docs/syscalls/ADD.md),\n     [`lchownAsync`](./docs/syscalls/ADD.md),\n     [`truncateAsync`](./docs/syscalls/ADD.md),\n     [`ftruncateAsync`](./docs/syscalls/ADD.md),\n     [`lseekAsync`](./docs/syscalls/ADD.md),\n     [`renameAsync`](./docs/syscalls/ADD.md),\n     [`fsyncAsync`](./docs/syscalls/ADD.md),\n     [`fdatasyncAsync`](./docs/syscalls/ADD.md)\n     \u0026nbsp;\n   - __Stats__: [`statAsync`](./docs/syscalls/ADD.md),\n     [`lstatAsync`](./docs/syscalls/ADD.md),\n     and [`fstatAsync`](./docs/syscalls/ADD.md)\n     \u0026nbsp;\n   - __Directories__: [`mkdirAsync`](./docs/syscalls/ADD.md),\n     [`mkdiratAsync`](./docs/syscalls/ADD.md),\n     [`rmdirAsync`](./docs/syscalls/ADD.md),\n     [`getcwdAsync`](./docs/syscalls/ADD.md),\n     [`getdents64Async`](./docs/syscalls/ADD.md),\n     and [`readdirListAsync`](./docs/syscalls/ADD.md)\n     \u0026nbsp;\n   - __Links__: [`symlinkAsync`](./docs/syscalls/ADD.md),\n     [`unlinkAsync`](./docs/syscalls/ADD.md),\n     [`readlinkAsync`](./docs/syscalls/ADD.md),\n     and [`linkAsync`](./docs/syscalls/ADD.md)\n     \u0026nbsp;\n   - __Time__: [`utimeAsync`](./docs/syscalls/ADD.md) and [`utimesAsync`](./docs/syscalls/ADD.md)\n     \u0026nbsp;\n   - __Networking__: [`socketAsync`](./docs/syscalls/ADD.md),\n     [`connectAsync`](./docs/syscalls/ADD.md),\n     [`bindAsync`](./docs/syscalls/ADD.md),\n     [`listenAsync`](./docs/syscalls/ADD.md),\n     [`acceptAsync`](./docs/syscalls/ADD.md),\n     [`accept4Async`](./docs/syscalls/ADD.md),\n     [`shutdownAsync`](./docs/syscalls/ADD.md),\n     [`sendAsync`](./docs/syscalls/ADD.md)\n     and [`sendtoAsync`](./docs/syscalls/ADD.md),\n     \u0026nbsp;\n   - __Process__: [`getpidAsync`](./docs/syscalls/ADD.md),\n     [`getppidAsync`](./docs/syscalls/ADD.md),\n     [`getuidAsync`](./docs/syscalls/ADD.md),\n     [`geteuidAsync`](./docs/syscalls/ADD.md),\n     [`getgidAsync`](./docs/syscalls/ADD.md),\n     and [`getegidAsync`](./docs/syscalls/ADD.md),\n     \u0026nbsp;\n- Structs\n   - `epoll_event` and `Iepoll_event`\n   - `in_addr` and `Iin_addr`\n   - `inotify_event` and `Iinotify_event`\n   - `ipc_perm` and `Iipc_perm`\n   - `ipv4` and `Iipv4`\n   - `linux_dirent64` and `Ilinux_dirent64`\n   - `shmid_ds` and `Ishmid_ds`\n   - `sigaction` and `Isigaction`\n   - `sockaddr` and `Isockaddr`\n   - `sockaddr_in` and `Isockaddr_in`\n   - `statStruct` and `IstatStruct`\n   - `timespec` and `Itimespec`\n   - `timeval` and `Itimeval`\n   - `timevalarr` and `Itimevalarr`\n   - `utimbuf` and `Iutimbuf`\n   - [`keventStruct`](./src/structs/kevent.ts) and [`IkeventStruct`](./src/structs/kevent.ts)\n   - [`kevent64_sStruct`](./src/structs/kevent64_s.ts) and [`Ikevent64_sStruct`](./src/structs/kevent64_s.ts)\n- Sockets\n   - `flip`,\n     `htons32`,\n     `hton16`,\n     `htons`,\n     `Ip`,\n     `Ipv4`,\n     and `Ipv6`,\n- Constants\n   - [`AF`](./src/consts/AF.ts),\n     [`AMODE`](./src/consts/AMODE.ts),\n     [`BUS`](./src/consts/BUS.ts),\n     [`CLD`](./src/consts/CLD.ts),\n     [`DT`](./src/consts/DT.ts),\n     [`EPOLL`](./src/consts/EPOLL.ts),\n     [`EPOLL_CTL`](./src/consts/EPOLL_CTL.ts),\n     [`EPOLL_EVENTS`](./src/consts/EPOLL_EVENTS.ts),\n     [`ERROR`](./src/consts/ERROR.ts),\n     [`EV`](./src/consts/EV.ts),\n     [`EVFILT`](./src/consts/EVFILT.ts),\n     [`FCNTL`](./src/consts/FCNTL.ts),\n     [`FD`](./src/consts/FD.ts),\n     [`FLAG`](./src/consts/FLAG.ts),\n     [`FPE`](./src/consts/FPE.ts),\n     [`ILL`](./src/consts/ILL.ts),\n     [`IN`](./src/consts/IN.ts),\n     [`IP`](./src/consts/IP.ts),\n     [`IPC`](./src/consts/IPC.ts),\n     [`IPPROT`](./src/consts/IPPROT.ts),\n     [`IPPROTO`](./src/consts/IPPROTO.ts),\n     [`IPV6`](./src/consts/IPV6.ts),\n     [`KEVENT`](./src/consts/KEVENT.ts),\n     [`MAP`](./src/consts/MAP.ts),\n     [`MCAST`](./src/consts/MCAST.ts),\n     [`MSG`](./src/consts/MSG.ts),\n     [`NOTE`](./src/consts/NOTE.ts),\n     [`PF`](./src/consts/PF.ts),\n     [`POLL`](./src/consts/POLL.ts),\n     [`PROT`](./src/consts/PROT.ts),\n     [`S`](./src/consts/S.ts),\n     [`SA`](./src/consts/SA.ts),\n     [`SEEK`](./src/consts/SEEK.ts),\n     [`SEGV`](./src/consts/SEGV.ts),\n     [`SHM`](./src/consts/SHM.ts),\n     [`SHUT`](./src/consts/SHUT.ts),\n     [`SI`](./src/consts/SI.ts),\n     [`SIG`](./src/consts/SIG.ts),\n     [`SIGEV`](./src/consts/SIGEV.ts),\n     [`SO`](./src/consts/SO.ts),\n     [`SOCK`](./src/consts/SOCK.ts),\n     [`SOL`](./src/consts/SOL.ts),\n     [`TRAP`](./src/consts/TRAP.ts)\n\n\n## License\n\n[Unlicense](./LICENSE) \u0026mdash; public domain.\n\n\n\n[npm-url]: https://www.npmjs.com/package/libjs\n[npm-badge]: https://img.shields.io/npm/v/libjs.svg\n[travis-url]: https://travis-ci.org/streamich/libjs\n[travis-badge]: https://travis-ci.org/streamich/libjs.svg?branch=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Flibjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamich%2Flibjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Flibjs/lists"}