{"_id":"@3-/binset","_rev":"5-9768f4957c50133bfffecad54a43642a","name":"@3-/binset","dist-tags":{"latest":"0.1.8"},"versions":{"0.1.2":{"name":"@3-/binset","version":"0.1.2","keywords":["binary","bitcode","hashset","rapidhash","set","wasm"],"author":{"name":"i18n.site@gmail.com"},"license":"MulanPSL-2.0","_id":"@3-/binset@0.1.2","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/i18n-site/lib/tree/dev/binset","bugs":{"url":"https://github.com/i18n-site/lib/issues"},"dist":{"shasum":"b4e978f98d192304d9265bd03bbf6e167bf1dd20","tarball":"https://registry.npmjs.org/@3-/binset/-/binset-0.1.2.tgz","fileCount":6,"integrity":"sha512-qqrbgfVn8KZGDVEeIREn/SY5CijIxMmpq4CTpFhjKeYz8YGuv3hyeNVMhSq5SZTvxCRXJp/wDaOLYkjpNJUHOA==","signatures":[{"sig":"MEQCIDON9OCr9QggaUg7TmNUo9uVnT/AJDbVElrvvGD+yrBMAiB2LqvLwApOdLVL15DJDt0rMgspqwLEU0B/00g59NMtig==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51884},"type":"module","gitHead":"80edd254ae24f5b1d8343d096dcdae54cd7e1d8e","_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/i18n-site/lib.git","type":"git"},"_npmVersion":"11.13.0","description":"High-performance WebAssembly binary set based on Rust HashSet (rapidhash) and Bitcode serialization / 基于 Rust HashSet (rapidhash) 与 Bitcode 序列化的高性能 WebAssembly 二进制集合","directories":{},"_nodeVersion":"25.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/binset_0.1.2_1779495759312_0.45138906609077645","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@3-/binset","version":"0.1.3","keywords":["binary","bitcode","hashset","rapidhash","set","wasm"],"author":{"name":"i18n.site@gmail.com"},"license":"MulanPSL-2.0","_id":"@3-/binset@0.1.3","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/i18n-site/lib/tree/dev/binset","bugs":{"url":"https://github.com/i18n-site/lib/issues"},"dist":{"shasum":"2fb24c43e4de00cad3eaeeed081f3d6e7f2a0815","tarball":"https://registry.npmjs.org/@3-/binset/-/binset-0.1.3.tgz","fileCount":6,"integrity":"sha512-I5zZggtVLLG669b9akjempTcOn1kcN4/mjHGM0JAdriguHQsd/cNJVsw3jw5BIhOzQSC/htj4+3Tv8Epgv/Pkg==","signatures":[{"sig":"MEUCIQDubwQfzahdKTEepyWnF5cxx5CqF/sAqWeTGBC3hMSQPgIgB/GueoNq3r6M3rtgi6dg2VmN8AoJZS/eg/DHhdIdngc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51884},"type":"module","gitHead":"7adb2167835ab20e00c8480e2ac0b90a2e83582f","_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/i18n-site/lib.git","type":"git"},"_npmVersion":"11.13.0","description":"High-performance WebAssembly binary set based on Rust HashSet (rapidhash) and Bitcode serialization / 基于 Rust HashSet (rapidhash) 与 Bitcode 序列化的高性能 WebAssembly 二进制集合","directories":{},"_nodeVersion":"25.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/binset_0.1.3_1779496671923_0.5990662735292442","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@3-/binset","version":"0.1.6","keywords":["binary","bitcode","hashset","rapidhash","set","wasm"],"author":{"name":"i18n.site@gmail.com"},"license":"MulanPSL-2.0","_id":"@3-/binset@0.1.6","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/i18n-site/lib/tree/dev/binset","bugs":{"url":"https://github.com/i18n-site/lib/issues"},"dist":{"shasum":"985d358098fc0428dbd6ace9717de12a79548fa0","tarball":"https://registry.npmjs.org/@3-/binset/-/binset-0.1.6.tgz","fileCount":6,"integrity":"sha512-CijNccQLleXH3KXGnSYXlBXnanDG71ZRFZXND5W3oGyBLiGMzjOKGAFf9pY9FDLjKaX+UmyCM7AOMdYZv9/Hfg==","signatures":[{"sig":"MEYCIQDXanpg24r18NBa3LpVIhqhR7zwkCM5/SieNGGX1DFWJwIhAIjggsALfwb2S8qmOc5B5TiviblPi52K/UY6D0oJW7en","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51959},"main":"./_.js","type":"module","types":"./_.d.ts","exports":{".":"./_.js","./*":"./*"},"gitHead":"39da2e376e922721d6d63a57919a18e841923967","_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/i18n-site/lib.git","type":"git"},"_npmVersion":"11.13.0","description":"High-performance WebAssembly binary set based on Rust HashSet (rapidhash) and Bitcode serialization / 基于 Rust HashSet (rapidhash) 与 Bitcode 序列化的高性能 WebAssembly 二进制集合","directories":{},"_nodeVersion":"26.2.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/binset_0.1.6_1780941631582_0.15434588730656218","host":"s3://npm-registry-packages-npm-production"}},"0.1.7":{"name":"@3-/binset","version":"0.1.7","keywords":["binary","bitcode","hashset","rapidhash","set","wasm"],"author":{"name":"i18n.site@gmail.com"},"license":"MulanPSL-2.0","_id":"@3-/binset@0.1.7","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/i18n-site/lib/tree/dev/binset","bugs":{"url":"https://github.com/i18n-site/lib/issues"},"dist":{"shasum":"b075301a2181b7b844a259dcc50afc282b12ead4","tarball":"https://registry.npmjs.org/@3-/binset/-/binset-0.1.7.tgz","fileCount":6,"integrity":"sha512-tZSkjtAduOdxgXrdQ4CJeW1iLVyesA+20UQeMRQGV2Kf+oZNYb5yWKz2ZQReibqbfkf4vsQq3FZu4BK/8ACdPA==","signatures":[{"sig":"MEUCIEDwMgdwr+ZvubpeCjbHOIcvvRJ+Al2hbiAvu4TEkY7jAiEAzNKjpLOQm2IiL0msQxFI8IvOIlsFY9KkMxDhzTlggOw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55525},"main":"./_.js","type":"module","types":"./_.d.ts","exports":{".":"./_.js","./*":"./*"},"gitHead":"53dcb55c474dc19de941bfdb775e9bd963d5309d","_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/i18n-site/lib.git","type":"git"},"_npmVersion":"11.16.0","description":"High-performance WebAssembly binary set based on Rust HashSet (rapidhash) and Bitcode serialization / 基于 Rust HashSet (rapidhash) 与 Bitcode 序列化的高性能 WebAssembly 二进制集合","directories":{},"_nodeVersion":"26.2.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/binset_0.1.7_1781155469298_0.14460968079233627","host":"s3://npm-registry-packages-npm-production"}},"0.1.8":{"name":"@3-/binset","version":"0.1.8","description":"High-performance WebAssembly binary set based on Rust HashSet (rapidhash) and Bitcode serialization / 基于 Rust HashSet (rapidhash) 与 Bitcode 序列化的高性能 WebAssembly 二进制集合","keywords":["binary","bitcode","hashset","rapidhash","set","wasm"],"homepage":"https://github.com/i18n-site/lib/tree/dev/binset","license":"MulanPSL-2.0","author":{"name":"i18n.site@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/i18n-site/lib.git"},"type":"module","main":"./_.js","exports":{".":"./_.js","./*":"./*"},"gitHead":"ec917ea82c2be88ecff51f7a5c068a115ee531c2","types":"./_.d.ts","_id":"@3-/binset@0.1.8","bugs":{"url":"https://github.com/i18n-site/lib/issues"},"_nodeVersion":"26.2.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-AAUrpM6n9u7XVgxbpxbo+zgxrl7V/8mVJ1rrYIO92vCrtuLpV96m244BNQ38YtMgSg2rOfw5Ju0VDY3JMrs9LQ==","shasum":"8c8df9f6628134e799b104a90a62913b8b228e02","tarball":"https://registry.npmjs.org/@3-/binset/-/binset-0.1.8.tgz","fileCount":6,"unpackedSize":57688,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCeS40UYd41QkMsyMF/OB1mJkch1tZdAHg+ISgdRFyjpgIhAI12j6IUXSBkN2cyP4M3cGP+5k0DwcMLoHmGx2t9i7qG"}]},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"directories":{},"maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/binset_0.1.8_1781270153220_0.36490056121085024"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-23T00:22:39.180Z","modified":"2026-06-12T13:15:53.509Z","0.1.2":"2026-05-23T00:22:39.454Z","0.1.3":"2026-05-23T00:37:52.131Z","0.1.6":"2026-06-08T18:00:31.727Z","0.1.7":"2026-06-11T05:24:29.491Z","0.1.8":"2026-06-12T13:15:53.383Z"},"bugs":{"url":"https://github.com/i18n-site/lib/issues"},"author":{"name":"i18n.site@gmail.com"},"license":"MulanPSL-2.0","homepage":"https://github.com/i18n-site/lib/tree/dev/binset","keywords":["binary","bitcode","hashset","rapidhash","set","wasm"],"repository":{"type":"git","url":"git+https://github.com/i18n-site/lib.git"},"description":"High-performance WebAssembly binary set based on Rust HashSet (rapidhash) and Bitcode serialization / 基于 Rust HashSet (rapidhash) 与 Bitcode 序列化的高性能 WebAssembly 二进制集合","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"readme":"# @3-/binset\n\n[English](#en) | [中文](#zh)\n\n---\n\n<a id=\"en\"></a>\n# BinSet : WebAssembly binary set based on Rust HashSet (rapidhash)\n\nWebAssembly binary set implementation. Built with Rust HashSet (using rapidhash), serialized using Bitcode, and compiled to WebAssembly.\n\n## Table of Contents\n\n- [Features](#features)\n- [Tech Stack](#tech-stack)\n- [Directory Structure](#directory-structure)\n- [Design Architecture](#design-architecture)\n- [Usage Demo](#usage-demo)\n- [API Reference](#api-reference)\n- [Historical Anecdote](#historical-anecdote)\n\n## Features\n\n- **High-Performance Storage**: Employs `RapidHashSet` (based on `rapidhash`) to achieve fast, $O(1)$ binary set operations.\n- **Serialization**: Uses Bitcode binary serialization for extremely compact and fast set dumping and loading.\n- **WebAssembly Engine**: Runs in Node.js and browser environments at native-like speeds.\n- **Binary Interface**: Operates directly on Uint8Array buffers without character encoding overhead.\n\n## Tech Stack\n\n- **Core Language**: Rust (2024 edition)\n- **Hashing Algorithm**: rapidhash (4.4.1)\n- **Serialization**: Bitcode (0.6.9)\n- **WASM Interface**: wasm-bindgen (0.2.122)\n- **Optimization**: wasm-opt (O3 optimization)\n\n## Directory Structure\n\n```text\n.\n├── Cargo.toml            # Rust cargo package configuration\n├── build.sh              # WebAssembly compilation script\n├── package.json          # npm package configuration\n├── run.sh                # Test runner script\n├── src\n│   └── lib.rs            # Rust library implementation code\n└── test.js               # JS test demo file\n```\n\n## Design Architecture\n\nThe following diagram illustrates the call flow and component relationships:\n\n```mermaid\ngraph TD\n    JS[JS Client] -->|add / has| WASM[WASM Binding Layer]\n    WASM -->|wasm-bindgen| Rust[Rust BinSet Struct]\n    Rust -->|Storage Operations| HashSet[rapidhash::RapidHashSet]\n    JS -->|dump / load| WASM\n    WASM -->|Serialization / Deserialization| Bitcode[Bitcode Crate]\n    Bitcode <-->|Binary Buffers| Rust\n```\n\n## Usage Demo\n\nExample written in CoffeeScript:\n\n```coffee\n#!/usr/bin/env coffee\n\n> ./pkg/_ > BinSet\n\ns = new BinSet\n\n# Insert binary values\ns.add(\n  new Uint8Array(1)\n)\n\ns.add new Uint8Array([5])\n\n# Dump set to serialized binary, then reload\ns = BinSet.load s.dump()\n\n# Query values\nconsole.log(\n  s.has(\n    new Uint8Array(1)\n  )\n)\nconsole.log s.size\n```\n\n## API Reference\n\n### `BinSet` Class\n\n- `constructor()`: Initializes empty BinSet.\n- `add(val: Uint8Array): void`: Inserts value.\n- `delete(val: Uint8Array): boolean`: Removes value, returns true if value was present and deleted, false otherwise.\n- `clear(): void`: Clears all values from set.\n- `has(val: Uint8Array): boolean`: Returns boolean indicating value presence.\n- `values(): Iterator<Uint8Array>`: Returns an iterator over the values.\n- `dump(): Uint8Array`: Serializes entire set into Uint8Array buffer.\n- `static load(bin: Uint8Array): BinSet`: Instantiates new set from serialized buffer.\n- `readonly size: number`: Returns total elements.\n\n## Historical Anecdote\n\nThe underlying hashing algorithm is rapidhash, the official successor to the famous wyhash non-cryptographic hash function. Wyhash was originally authored by Wang Yi. rapidhash was developed to push performance even further on modern CPUs while fully passing the rigorous SMHasher and SMHasher3 test suites for collision resistance and statistical quality.\n\n---\n\n<a id=\"zh\"></a>\n# BinSet : 基于 Rust HashSet (rapidhash) 的 WebAssembly 二进制集合\n\n二进制集合实现。基于 Rust HashSet（使用 rapidhash 算法），配合 Bitcode 序列化，编译为 WebAssembly。\n\n## 目录\n\n- [功能特性](#功能特性)\n- [技术栈](#技术栈)\n- [目录结构](#目录结构)\n- [设计思路与架构](#设计思路与架构)\n- [使用演示](#使用演示)\n- [API 说明](#api-说明)\n- [历史小故事](#历史小故事)\n\n## 功能特性\n\n- **高性能存储**：使用 `RapidHashSet`（基于 `rapidhash`），实现快速的 $O(1)$ 二进制集合操作。\n- **序列化**：使用 Bitcode 序列化协议，实现极度紧凑且快速的数据导出与导入。\n- **WebAssembly 运行**：支持 Node.js 及浏览器环境，运行效率高。\n- **二进制接口**：直接操作 Uint8Array，避免字符编码转换开销。\n\n## 技术栈\n\n- **核心语言**：Rust (2024 edition)\n- **哈希算法**：rapidhash (4.4.1)\n- **序列化库**：Bitcode (0.6.9)\n- **WASM 接口**：wasm-bindgen (0.2.122)\n- **体积优化**：wasm-opt (O3 优化)\n\n## 目录结构\n\n```text\n.\n├── Cargo.toml            # Rust 项目配置\n├── build.sh              # WebAssembly 编译脚本\n├── package.json          # npm 包配置\n├── run.sh                # 测试运行脚本\n├── src\n│   └── lib.rs            # Rust 库源码\n└── test.js               # JS 测试演示\n```\n\n## 设计思路与架构\n\n下图展示模块调用关系与数据流动：\n\n```mermaid\ngraph TD\n    JS[JS 客户端] -->|add / has| WASM[WASM 绑定层]\n    WASM -->|wasm-bindgen| Rust[Rust BinSet 结构体]\n    Rust -->|存储操作| HashSet[rapidhash::RapidHashSet]\n    JS -->|dump / load| WASM\n    WASM -->|序列化 / 反序列化| Bitcode[Bitcode 库]\n    Bitcode <-->|二进制缓冲区| Rust\n```\n\n## 使用演示\n\nCoffeeScript 演示代码如下：\n\n```coffee\n#!/usr/bin/env coffee\n\n> ./pkg/_ > BinSet\n\ns = new BinSet\n\n# 插入二进制值\ns.add(\n  new Uint8Array(1)\n)\n\ns.add new Uint8Array([5])\n\n# 序列化导出并重新加载\ns = BinSet.load s.dump()\n\n# 查询值\nconsole.log(\n  s.has(\n    new Uint8Array(1)\n  )\n)\nconsole.log s.size\n```\n\n## API 说明\n\n### `BinSet` 类\n\n- `constructor()`：初始化空集合。\n- `add(val: Uint8Array): void`：插入值。\n- `delete(val: Uint8Array): boolean`：删除值，若存在且删除成功返回 `true`，否则返回 `false`。\n- `clear(): void`：清空集合。\n- `has(val: Uint8Array): boolean`：判断值是否存在。\n- `values(): Iterator<Uint8Array>`：获取包含所有值的迭代器。\n- `dump(): Uint8Array`：将集合序列化为 Uint8Array 缓冲区。\n- `static load(bin: Uint8Array): BinSet`：从二进制缓冲区反序列化并构建 BinSet。\n- `readonly size: number`：返回集合内元素总数。\n\n## 历史小故事\n\n底层哈希算法 rapidhash 是著名的非加密哈希算法 wyhash 的官方继承者。wyhash 最初由王一（Wang Yi）设计。rapidhash 的开发旨在进一步提升在现代 CPU 上的性能表现，同时完全通过了严格的 SMHasher 和 SMHasher3 哈希碰撞与质量测试套件。\n\n---\n\n## About\n\nThis project is an open-source component of [i18n.site ⋅ Internationalization Solution](https://i18n.site).\n\n- [i18 : MarkDown Command Line Translation Tool](https://i18n.site/i18)\n\n  The translation perfectly maintains the Markdown format.\n\n  It recognizes file changes and only translates the modified files.\n\n  The translated Markdown content is editable; if you modify the original text and translate it again, manually edited translations will not be overwritten (as long as the original text has not been changed).\n\n- [i18n.site : MarkDown Multi-language Static Site Generator](https://i18n.site/i18n.site)\n\n  Optimized for a better reading experience\n\n## 关于\n\n本项目为 [i18n.site ⋅ 国际化解决方案](https://i18n.site) 的开源组件。\n\n- [i18 : MarkDown命令行翻译工具](https://i18n.site/i18)\n\n  翻译能够完美保持 Markdown 的格式。能识别文件的修改，仅翻译有变动的文件。\n\n  Markdown 翻译内容可编辑；如果你修改原文并再次机器翻译，手动修改过的翻译不会被覆盖（如果这段原文没有被修改）。\n\n- [i18n.site : MarkDown多语言静态站点生成器](https://i18n.site/i18n.site) 为阅读体验而优化。\n","readmeFilename":"README.md"}