npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bfast-client

v1.1.0

Published

Client for ⚡ B-FAST (Binary Fast Adaptive Serialization Transfer) - Protocolo de serialização binária de ultra-alta performance

Readme

bfast-client

Client ultra-fast binary decoder for ⚡B-FAST format in TypeScript/JavaScript.

Installation

npm install bfast-client

Usage

Basic Decoding

import { BFastDecoder } from 'bfast-client';

// Fetch B-FAST data from API
const response = await fetch('/api/data');
const buffer = await response.arrayBuffer();

// Decode (automatically handles LZ4 decompression)
const data = BFastDecoder.decode(buffer);
console.log(data);

Error Handling

import { BFastDecoder, BFastError } from 'bfast-client';

try {
    const data = BFastDecoder.decode(buffer);
    console.log(data);
} catch (error) {
    if (error instanceof BFastError) {
        console.error('B-FAST decode error:', error.message);
    } else {
        console.error('Unexpected error:', error);
    }
}

React Hook

import { useState, useEffect } from 'react';
import { BFastDecoder } from 'bfast-client';

function useBFastData<T>(url: string) {
    const [data, setData] = useState<T | null>(null);
    const [loading, setLoading] = useState(true);
    const [error, setError] = useState<string | null>(null);

    useEffect(() => {
        async function fetchData() {
            try {
                const response = await fetch(url);
                const buffer = await response.arrayBuffer();
                const decoded = BFastDecoder.decode(buffer);
                setData(decoded);
            } catch (err) {
                setError(err instanceof Error ? err.message : 'Unknown error');
            } finally {
                setLoading(false);
            }
        }
        fetchData();
    }, [url]);

    return { data, loading, error };
}

Axios Integration

import axios from 'axios';
import { BFastDecoder } from 'bfast-client';

// Configure axios to handle B-FAST responses
axios.interceptors.response.use(response => {
    if (response.headers['content-type'] === 'application/x-bfast') {
        response.data = BFastDecoder.decode(response.data);
    }
    return response;
});

// Use normally
const { data } = await axios.get('/api/users');
console.log(data); // Already decoded

Supported Types

  • Primitives: null, boolean, number, string
  • Collections: Array, Object
  • Special Types: UUID, Date, NumPy arrays
  • Compression: Automatic LZ4 decompression detection

Performance

B-FAST provides significant performance improvements over JSON:

  • 15x faster than standard JSON
  • 3x faster than orjson
  • 80% smaller payload size
  • Zero-copy NumPy array handling

Browser Compatibility

| Browser | Version | |---------|---------| | Chrome | 60+ | | Firefox | 55+ | | Safari | 12+ | | Edge | 79+ | | Node.js | 14+ |

API Reference

BFastDecoder.decode(buffer)

Decodes B-FAST binary data to JavaScript objects.

Parameters:

  • buffer - ArrayBuffer or Uint8Array containing B-FAST data

Returns:

  • Decoded JavaScript object

Throws:

  • BFastError - If decoding fails

BFastError

Custom error class for B-FAST decoding errors.

License

MIT