WebAssembly (JavaScript and TypeScript) library for czv. czv is a library of CSV-related operations for data engineering and analysis tasks.
- czv GitHub repository: https://github.com/rzmk/czv
- Rust: crates.io/crates/czv (source code)
- WebAssembly (JavaScript/TypeScript): npmjs.com/package/czv-wasm (source code)
- Python: pypi.org/project/czv (source code)
bun install czv-wasm
Or use npm
, pnpm
, or yarn
instead of bun
.
The following example is written in TypeScript:
import init, * as czv from "czv-wasm";
// Must run `await init()` or `initSync()` first for web use
await init();
const data = `fruits,price
apple,2.50
banana,3.00
strawberry,1.50`;
const output: number = czv.rowCount({
file_data: data,
include_header_row: true,
});
console.log(output);
You must have wasm-pack installed. If you have Cargo installed you may run:
cargo install wasm-pack
wasm-pack build --release --target web
Note: Currently you must modify the pkg/package.json
by replacing the name from czv-wasm
to czv
.
wasm-pack test --firefox --release
You may replace --firefox
with another browser such as --chrome
and --safari
.
Getting a Package name too similar to existing package csv
when trying to publish the package as czv
so we publish the package as czv-wasm
.
- Build the
pkg
folder withwasm-pack build --release --target web
. - Run
cd pkg
.
- Run
npm pkg fix
as suggested. - Run
npm publish
.