{"_id":"chdb-wasm","_rev":"5-76779762a5ebead006606d14d498de16","name":"chdb-wasm","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"chdb-wasm","version":"0.1.0","keywords":["clickhouse","chdb","wasm","webassembly","sql","olap","database"],"license":"Apache-2.0","_id":"chdb-wasm@0.1.0","maintainers":[{"name":"wudidapaopao","email":"664920313@qq.com"}],"homepage":"https://github.com/chdb-io/chdb-core/tree/main/packages/chdb-wasm#readme","bugs":{"url":"https://github.com/chdb-io/chdb-core/issues"},"dist":{"shasum":"301364861e77c28d1655757c47937562b62baf2e","tarball":"https://registry.npmjs.org/chdb-wasm/-/chdb-wasm-0.1.0.tgz","fileCount":42,"integrity":"sha512-9rO9QYbXPhc+vVLR7BZqipHVg/0uFQw6Gy7FjxHWVGnf3p0QP9/GoyJbeoqVaADKCFJtydsRKuNlIFM6weILjA==","signatures":[{"sig":"MEUCIDOmVWzZwlr1/k9si613QtcaBfJWpYgYVRjHK8m3dy+vAiEAx83qvvrSOTWWroOt+TbXH+yflQAAIL5gT9rEDa6IxTc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":200015984},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=23"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./worker":"./dist/worker.js","./chdb.wasm":"./dist/chdb.wasm"},"scripts":{"build":"tsc -p tsconfig.json && node scripts/copy-artifacts.mjs","test:node":"node test/smoke.test.mjs","typecheck":"tsc -p tsconfig.json --noEmit","test:matrix":"node test/matrix.test.mjs","test:browser":"node test/browser-run.mjs"},"_npmUser":{"name":"wudidapaopao","email":"664920313@qq.com"},"repository":{"url":"git+https://github.com/chdb-io/chdb-core.git","type":"git","directory":"packages/chdb-wasm"},"_npmVersion":"10.8.2","description":"chdb (ClickHouse) compiled to WebAssembly, with an async, non-blocking, worker-based API","directories":{},"_nodeVersion":"20.20.1","_hasShrinkwrap":false,"devDependencies":{"puppeteer":"^25.1.0","typescript":"^5.7.2","@types/node":"^22.19.19"},"_npmOperationalInternal":{"tmp":"tmp/chdb-wasm_0.1.0_1782297864604_0.4407305504874828","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"chdb-wasm","version":"0.2.0","keywords":["clickhouse","chdb","wasm","webassembly","sql","olap","database"],"license":"Apache-2.0","_id":"chdb-wasm@0.2.0","maintainers":[{"name":"wudidapaopao","email":"664920313@qq.com"}],"homepage":"https://github.com/chdb-io/chdb-core/tree/main/packages/chdb-wasm#readme","bugs":{"url":"https://github.com/chdb-io/chdb-core/issues"},"dist":{"shasum":"9554c17c386832cd4d4b9324ca88dcdba6365db6","tarball":"https://registry.npmjs.org/chdb-wasm/-/chdb-wasm-0.2.0.tgz","fileCount":42,"integrity":"sha512-HV5yWyuEtvmIQuwURvzvInR5M/Z+/09MTQZ5MUHmCOaAwPUOivnLvCb9c9upOzzbT/pgsW0HWyg68soGUoFUXQ==","signatures":[{"sig":"MEYCIQDGJDk5YOrThuXDOf0iGGJCzNQiC7qLK92HgsFswbkGpQIhANWvS74tzhftqRj2orKyoGBUin+H+xOCHrAXhdvy/0Az","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":200051060},"main":"./dist/index.js","type":"module","_from":"file:chdb-wasm-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=23"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./worker":"./dist/worker.js","./chdb.wasm":"./dist/chdb.wasm"},"scripts":{"build":"tsc -p tsconfig.json && node scripts/copy-artifacts.mjs","test:node":"node test/smoke.test.mjs","typecheck":"tsc -p tsconfig.json --noEmit","test:matrix":"node test/matrix.test.mjs","test:browser":"node test/browser-run.mjs"},"_npmUser":{"name":"wudidapaopao","email":"664920313@qq.com"},"_resolved":"/home/ubuntu/code/chdb-wasm/packages/chdb-wasm/chdb-wasm-0.2.0.tgz","_integrity":"sha512-HV5yWyuEtvmIQuwURvzvInR5M/Z+/09MTQZ5MUHmCOaAwPUOivnLvCb9c9upOzzbT/pgsW0HWyg68soGUoFUXQ==","repository":{"url":"git+https://github.com/chdb-io/chdb-core.git","type":"git","directory":"packages/chdb-wasm"},"_npmVersion":"10.8.2","description":"chdb (ClickHouse) compiled to WebAssembly, with an async, non-blocking, worker-based API","directories":{},"_nodeVersion":"20.20.1","_hasShrinkwrap":false,"devDependencies":{"puppeteer":"^25.1.0","typescript":"^5.7.2","@types/node":"^22.19.19"},"_npmOperationalInternal":{"tmp":"tmp/chdb-wasm_0.2.0_1782884567790_0.5239070829790913","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"chdb-wasm","version":"0.3.0","keywords":["clickhouse","chdb","wasm","webassembly","sql","olap","database"],"license":"Apache-2.0","_id":"chdb-wasm@0.3.0","maintainers":[{"name":"wudidapaopao","email":"664920313@qq.com"}],"homepage":"https://github.com/chdb-io/chdb-core/tree/main/packages/chdb-wasm#readme","bugs":{"url":"https://github.com/chdb-io/chdb-core/issues"},"dist":{"shasum":"e3e79a50caf69ca25403cc4ab67a1210b12f67a3","tarball":"https://registry.npmjs.org/chdb-wasm/-/chdb-wasm-0.3.0.tgz","fileCount":42,"integrity":"sha512-vIw0FVqRF+1dHgReiH5wIjCikNGTWMO2xb/wQLfsU0AFZRY435xfUrMlPSTBzuJ0UvsPo0dsU+VFVRnAxTbRkQ==","signatures":[{"sig":"MEUCIQDyL1TDFxqmk24Wl3Kd1XIi3yl/NFAEOGods9EZqi9ShwIgFszSK3Ma31PZ4xYWu2dueyBgWVwKcKMSDlRX1zKjPz8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":208559717},"main":"./dist/index.js","type":"module","_from":"file:chdb-wasm-0.3.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=23"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./worker":"./dist/worker.js","./chdb.wasm":"./dist/chdb.wasm"},"scripts":{"build":"tsc -p tsconfig.json && node scripts/copy-artifacts.mjs","test:node":"node test/smoke.test.mjs","typecheck":"tsc -p tsconfig.json --noEmit","test:matrix":"node test/matrix.test.mjs","test:browser":"node test/browser-run.mjs"},"_npmUser":{"name":"wudidapaopao","email":"664920313@qq.com"},"_resolved":"/home/ubuntu/code/chdb-wasm/packages/chdb-wasm/chdb-wasm-0.3.0.tgz","_integrity":"sha512-vIw0FVqRF+1dHgReiH5wIjCikNGTWMO2xb/wQLfsU0AFZRY435xfUrMlPSTBzuJ0UvsPo0dsU+VFVRnAxTbRkQ==","repository":{"url":"git+https://github.com/chdb-io/chdb-core.git","type":"git","directory":"packages/chdb-wasm"},"_npmVersion":"10.8.2","description":"chdb (ClickHouse) compiled to WebAssembly, with an async, non-blocking, worker-based API","directories":{},"_nodeVersion":"20.20.1","_hasShrinkwrap":false,"devDependencies":{"puppeteer":"^25.1.0","typescript":"^5.7.2","@types/node":"^22.19.19"},"_npmOperationalInternal":{"tmp":"tmp/chdb-wasm_0.3.0_1783506734877_0.5780945548784855","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"chdb-wasm","version":"0.4.0","keywords":["clickhouse","chdb","wasm","webassembly","sql","olap","database"],"license":"Apache-2.0","_id":"chdb-wasm@0.4.0","maintainers":[{"name":"wudidapaopao","email":"664920313@qq.com"}],"homepage":"https://github.com/chdb-io/chdb-core/tree/main/packages/chdb-wasm#readme","bugs":{"url":"https://github.com/chdb-io/chdb-core/issues"},"dist":{"shasum":"a9ce30f58f13c1a191d9636b2152167acd54d219","tarball":"https://registry.npmjs.org/chdb-wasm/-/chdb-wasm-0.4.0.tgz","fileCount":47,"integrity":"sha512-ZLVu3gwx3JZ3IEe5MBZOKJLzLQyraKbx0kgqCs69kWhx19UPAvSkwLNJXFpI7ypZUVd0+PjC7IKHMpptSRVw0g==","signatures":[{"sig":"MEQCIAzolPsaAKZx+rYo8hTrKO5Of6STNUkRJSo5gwGRTMWHAiAFIXkRGVm+Gtyn0fLQeWzLdmPL2F50CfxIaz91LYrGuw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":316650035},"main":"./dist/index.js","type":"module","_from":"file:chdb-wasm-0.4.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=23"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./worker":"./dist/worker.js","./chdb.wasm":"./dist/chdb.wasm"},"scripts":{"build":"tsc -p tsconfig.json && node scripts/copy-artifacts.mjs","test:node":"node test/smoke.test.mjs","typecheck":"tsc -p tsconfig.json --noEmit","test:matrix":"node test/matrix.test.mjs","test:browser":"node test/browser-run.mjs"},"_npmUser":{"name":"wudidapaopao","email":"664920313@qq.com"},"_resolved":"/opt/actions-runner/_work/chdb-core/chdb-core/packages/chdb-wasm/chdb-wasm-0.4.0.tgz","_integrity":"sha512-ZLVu3gwx3JZ3IEe5MBZOKJLzLQyraKbx0kgqCs69kWhx19UPAvSkwLNJXFpI7ypZUVd0+PjC7IKHMpptSRVw0g==","repository":{"url":"git+https://github.com/chdb-io/chdb-core.git","type":"git","directory":"packages/chdb-wasm"},"_npmVersion":"11.17.0","description":"chdb (ClickHouse) compiled to WebAssembly, with an async, non-blocking, worker-based API","directories":{},"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"devDependencies":{"puppeteer":"^25.1.0","typescript":"^5.7.2","@types/node":"^22.19.19"},"_npmOperationalInternal":{"tmp":"tmp/chdb-wasm_0.4.0_1786380552131_0.4325262072679552","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-06-24T10:44:24.429Z","modified":"2026-09-17T07:36:04.220Z","0.1.0":"2026-06-24T10:44:25.441Z","0.2.0":"2026-07-01T05:42:48.429Z","0.3.0":"2026-07-08T10:32:15.533Z","0.4.0":"2026-08-10T16:49:12.961Z"},"bugs":{"url":"https://github.com/chdb-io/chdb-core/issues"},"license":"Apache-2.0","homepage":"https://github.com/chdb-io/chdb-core/tree/main/packages/chdb-wasm#readme","keywords":["clickhouse","chdb","wasm","webassembly","sql","olap","database"],"repository":{"url":"git+https://github.com/chdb-io/chdb-core.git","type":"git","directory":"packages/chdb-wasm"},"description":"chdb (ClickHouse) compiled to WebAssembly, with an async, non-blocking, worker-based API","maintainers":[{"email":"664920313@qq.com","name":"wudidapaopao"},{"email":"chenchangshuoshawn@gmail.com","name":"shawnsirius"}],"readme":"# chdb-wasm\n\n[chdb](https://github.com/chdb-io/chdb) (an embedded [ClickHouse](https://clickhouse.com)) compiled to WebAssembly, with an **async, non-blocking, worker-based** JS/TS API.\n\nThe wasm engine runs inside a Web Worker, so queries return Promises and the\ncaller's thread (your UI / event loop) is never blocked.\n\n## Requirements\n\nchdb's wasm is built for the **Memory64** ABI with native **wasm exceptions**, so it\nneeds a recent runtime:\n\n- **Node ≥ 23** (Memory64 + `WASM_BIGINT`), or a recent Chrome/Firefox.\n\nTwo bundles are shipped and auto-selected by `selectBundle()`:\n\n- **mt** (multi-threaded): in the **browser** it needs **cross-origin isolation** — serve with\n  `Cross-Origin-Opener-Policy: same-origin` + `Cross-Origin-Embedder-Policy: require-corp`.\n- **st** (single-threaded): runs on any page, no isolation required.\n\n`selectBundle()` picks `mt` on a cross-origin-isolated page (SharedArrayBuffer available),\notherwise `st`, and reports if the runtime can't run it at all.\n\n## Usage (Node)\n\n```js\nimport { AsyncChdb } from 'chdb-wasm';\n\nconst db = await AsyncChdb.create({ moduleUrl: '/path/to/chdb.mjs' });\n\nconst r = await db.query('SELECT 1');\nconsole.log(r.text());                 // \"1\\n\"\nconsole.log(r.rowsRead, r.elapsedSeconds);\n\n// explicit connection + streaming\nconst conn = await db.connect();\nfor await (const chunk of conn.queryStream('SELECT number FROM numbers(1e7)')) {\n  process.stdout.write(chunk.data);    // Uint8Array, processed chunk-by-chunk\n}\nawait conn.close();\n\nawait db.terminate();\n```\n\n`query(sql, format?)` accepts any ClickHouse output format (`'CSV'` default,\n`'JSONEachRow'`, `'Arrow'`, …). Results expose `data: Uint8Array`, `text()`,\n`rowsRead`, `bytesRead`, `elapsedSeconds`.\n\n## Usage (browser)\n\n```js\nimport { AsyncChdb, selectBundle } from 'chdb-wasm';\n\nconst bundle = selectBundle({ baseUrl: '/node_modules/chdb-wasm/dist' });\nif (!bundle.supported) throw new Error(bundle.reasons.join('; '));\n\nconst db = await AsyncChdb.create({\n  moduleUrl: bundle.moduleUrl,\n  wasmUrl: bundle.wasmUrl,\n  onProgress: (loaded, total) => console.log(`${loaded}/${total}`),\n});\n```\n\n## Build / test\n\n```bash\n# 1. build both wasm bundles (from the chdb repo root, with emsdk sourced):\nchdb/build-wasm.sh build                                          # mt -> buildwasm/\nWASM_THREADS=OFF BUILD_DIR=buildwasm-st chdb/build-wasm.sh build   # st -> buildwasm-st/\n# 2. copy both bundles into the package and build TS -> dist (mt -> dist/, st -> dist/st/):\nnode packages/chdb-wasm/scripts/copy-artifacts.mjs buildwasm/programs/wasm buildwasm-st/programs/wasm\nnpm --prefix packages/chdb-wasm run build       # tsc -> dist/\n\n# Node test (runs the .ts source directly via Node's type stripping):\nnode packages/chdb-wasm/test/smoke.test.mjs\n\n# Browser test (headless Chrome, both bundles):\nnode packages/chdb-wasm/test/browser-run.mjs\n```\n\n## Build knobs (CMake)\n\nTwo bundles are built — **mt** (threaded) and **st** (single-threaded) — both Memory64 +\nnative exceptions, `-Oz` (`WASM_THREADS=ON`/`OFF` selects which). Operational knobs on the\n`chdb_wasm` CMake target:\n\n| option | default | meaning |\n| --- | --- | --- |\n| `WASM_STACK_SIZE` | `8MB` | main-thread C++ stack |\n| `WASM_PTHREAD_STACK_SIZE` | `2MB` | per-worker stack (×pool size — dominates baseline memory) |\n| `WASM_PTHREAD_POOL_SIZE` | `16` | pre-spawned worker pool, mt only (must cover ClickHouse's peak live threads) |\n| `WASM_INITIAL_MEMORY` | `128MB` | initial heap |\n","readmeFilename":"README.md"}