🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@huggingface/xetchunk-wasm

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huggingface/xetchunk-wasm

JS and WASM implementations of https://github.com/huggingface/xet-core/blob/main/deduplication/src/chunking.rs

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
70K
1.96%
Maintainers
4
Weekly downloads
 
Created
Source

JS and WASM implementations of https://github.com/huggingface/xet-core/blob/main/deduplication/src/chunking.rs

Using AssemblyScript to generate a lean WASM.

Usage

import { createChunker, getChunks, nextBlock, finalize } from '@huggingface/xetchunk-wasm';

const TARGET_CHUNK_SIZE = Math.pow(2, 12);

// Create a Uint8Array of data to search through
const data = new Uint8Array(1000000); // Example: 1MB of data
// ... fill data with your content ...

const chunks = getChunks(data, TARGET_CHUNK_SIZE);

// Alternative, in case your data is streaming
const chunker = createChunker(TARGET_CHUNK_SIZE);

for await (const data of source) {
  const chunks = nextBlock(chunker, data);
  console.log(chunks);
}

console.log("last chunk", finalize(chunker));

Keywords

xet

FAQs

Package last updated on 08 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts