GitHub Hot Board

GitHub Hot Board · 저장소 아카이브

mimiMonads/knitting

A shared-memory concurrency runtime for Javascript (소개는 저장소 자체 문서에서 왔습니다.)

데이터 기준 October 22mimiMonads

최고 순위

#141

과소평가 · 활발한데 무명

100

누적 스타

1

포크 수

1

최근 30일 기록 일수

프로젝트 상태라이선스: 미확인최근 push: 미확인열린 이슈(PR 포함): 미확인

2026-10-25부터 수집. 미확인 = 아직 미수집

README에 뱃지를 붙여보세요 · mimiMonads/knitting[![README에 뱃지를 붙여보세요](https://git.vaiox.xyz/api/badge/mimiMonads/knitting.svg)](https://git.vaiox.xyz/ko/repo/mimiMonads/knitting)
<a href="https://git.vaiox.xyz/ko/repo/mimiMonads/knitting"><img src="https://git.vaiox.xyz/api/badge/mimiMonads/knitting.svg" alt="README에 뱃지를 붙여보세요" height="20"></a>

프로젝트 문서

knitting

JSR Version npm Version Tests Coverage Workflow License

Knitting is a worker pool for Node.js, Deno, and Bun, with a focus on HTTP servers and request offloading. It runs JavaScript and TypeScript functions in threads or separate processes. Calls use shared memory, and results come back as promises.

Website: js.knitting.run

For agents, the website provides a compact documentation map in llms.txt and full documentation in llms-full.txt.

Knitting specializes in:

  • Offloading CPU-heavy work from HTTP request handlers.
  • Parsing and validating request bodies.
  • Server-side rendering and compression.
  • Sharing large buffers between workers.
  • Running tasks across threads and processes.

Documentation · API guide · Source map · Discord

Install

npm install knitting

For Deno, use deno add --npm knitting.

Example

Save this as example.mjs:

import { createPool, isMain } from "knitting";

export const square = (value) => value * value;
export const greet = (name) => `hello ${name}`;

if (isMain) {
  const pool = createPool({ threads: 2 })({ square, greet });

  try {
    const [four, message] = await Promise.all([
      pool.call.square(2),
      pool.call.greet("knitting"),
    ]);
    console.log({ four, message });
  } finally {
    await pool.shutdown();
  }
}

Run it with Node.js, Bun, or Deno:

node example.mjs
bun example.mjs
deno run -A example.mjs

The result is { four: 4, message: "hello knitting" }.

Export your functions so workers can load them. Keep pool creation inside if (isMain) so workers don't create pools of their own. Call shutdown() when you're done; finally makes sure it also runs if a task fails.

This example works on Node.js 22. Runtimes with await using can use it for cleanup instead; see pool cleanup. Deno's -A grants all permissions for the example.

Features

  • Typed function calls across threads and processes.
  • Timeouts and cancellation.
  • JSON, typed arrays, and shared buffers.
  • Work stealing and scheduling options.
  • Browser support for pages with cross-origin isolation enabled.

See the API guide for configuration and experimental backends.

Runtime support

Knitting requires Node.js 22+, Deno 2+, or Bun 1+. The test workflow covers Linux, macOS, and Windows; check it for tested versions and results.

Node.js native addons are packaged for 22 and 24 on Linux x64, macOS x64/arm64, and Windows x64. Node.js 26 has an experimental FFI backend. See native support for details.

Permissions depend on the runtime and worker type. Read the permission guide when setting up process isolation.

Benchmarks

Shared memory can reduce the cost of sending work to a worker. How much it helps depends on the task, payload, runtime, and pool settings.

./run.sh --json --bench=doorbell --runtime=node

See the benchmarks for commands, measurements, and reports. Compare repeated runs with the same settings, and test your own workload before drawing conclusions.

Development

Bun runs the build scripts. Install Node.js and Deno too if you want to test all three runtimes.

bun install --frozen-lockfile
bun run build
npm run test:node
npm run test:bun
npm run test:deno

See Contributing for native builds, browser tests, and pull requests. Report security issues using the security policy.

License

Apache-2.0.

현재 순위

  • 141

    과소평가 · 활발한데 무명

    100 스타 · 1 fork · 총 스타 수(오름차순)

    과소평가 →

최근 30일 추이

누적 스타 추이

순위 추이

← 랭킹으로