| Crates.io | jsbt-rust |
| lib.rs | jsbt-rust |
| version | 0.1.1 |
| created_at | 2025-12-13 08:40:22.45887+00 |
| updated_at | 2025-12-13 08:48:12.937628+00 |
| description | A Rust implementation of the JSBT binary serialization format for interoperability with JavaScript |
| homepage | |
| repository | https://github.com/mrorigo/jsbt-rust |
| max_upload_size | |
| id | 1982730 |
| size | 154,869 |
A Rust implementation of the JSBT (JavaScript Binary Transfer) serialization format for interoperability with JavaScript.
jsbt-rust allows you to serialize and deserialize data in the JSBT format, ensuring byte-for-byte compatibility with the JavaScript/TypeScript implementation. This is ideal for high-performance data exchange between Rust backend services and JavaScript frontends or Node.js processes.
null, undefined, bool, integer, float, string) and complex types (BigInt, Array, Object, Set, Map, Date, Symbol, TypedArray).async decoding via the full_async feature.serde for Rust type serialization.Add this to your Cargo.toml:
[dependencies]
jsbt-rust = "0.1.0"
use jsbt_rust::{JSBTValue, EncodeOptions, DecodeOptions, encoder::encode_value, decoder::decode_value_sync, reader::ByteReader};
use std::io::Cursor;
fn main() {
let value = JSBTValue::String("Hello, World!".to_string());
// Encode
let mut encode_ops = EncodeOptions::default();
let mut buffer = Vec::new();
encode_value(&value, &mut encode_ops, &mut buffer).unwrap();
// Decode
let cursor = Cursor::new(buffer);
let mut reader = ByteReader::new(cursor);
let mut decode_ops = DecodeOptions::default();
let decoded_value = decode_value_sync(&mut reader, &mut decode_ops).unwrap();
assert_eq!(value, decoded_value);
}
full_async: Enables asynchronous decoding functions using tokio and async-base.This library is a Rust port of the original TypeScript implementation ts-jsbt by Alexander Cheprasov (@cheprasov).
MIT