@usecolf/client
v1.0.3
Published
COLF Browser / Client SDK with transparent colfFetch HTTP wrapper and decode decoder
Readme
@usecolf/client
COLF Client SDK with
colfFetchHTTP wrapper and automatic response decoder for browser and web environments.
Overview
@usecolf/client provides client-side utilities for fetching and automatically unpacking COLF API responses. The included colfFetch wrapper sets Accept: application/vnd.colf+json and seamlessly unpacks compressed columnar JSON back into standard JavaScript arrays of objects.
Features
- Drop-in
fetchReplacement:colfFetchshares the exact signature as browser nativefetch. - Automatic Content Negotiation: Automatically adds COLF headers and decodes
application/vnd.colf+jsonresponses. - Transparent Decoding: Returns parsed JavaScript array objects transparently in
response.json().
Installation
npm install @usecolf/client
# or
pnpm add @usecolf/clientQuick Start
import { colfFetch, decode } from '@usecolf/client';
// Use colfFetch just like standard fetch
const response = await colfFetch('/api/users');
const users = await response.json();
console.log(users); // Standard array of objects: [{ id: 1, name: 'Alice' }, ...]License
MIT © COLF Team
