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

@qualithm/arrow-flight-client

v0.1.4

Published

Unified Arrow Flight and Flight SQL client for JavaScript and TypeScript runtimes.

Downloads

661

Readme

Arrow Flight Client

CI codecov npm

Unified Arrow Flight and Flight SQL client for JavaScript and TypeScript runtimes. Provides complete gRPC client support for Apache Arrow Flight and Flight SQL protocols.

Features

  • Flight RPC — All core methods: listFlights, getFlightInfo, doGet, doPut, doAction, etc.
  • Flight SQL — SQL queries, prepared statements, transactions, and database metadata
  • Authentication — Bearer tokens, mTLS, and Flight Handshake (BasicAuth)
  • Arrow IPC — Encode/decode Apache Arrow data for streaming transfers
  • Multi-runtime — Works with Bun, Node.js 20+, and Deno

Installation

bun add @qualithm/arrow-flight-client
# or
npm install @qualithm/arrow-flight-client

Quick Start

import { createFlightClient, decodeFlightDataToTable } from "@qualithm/arrow-flight-client"

const client = createFlightClient({
  url: "http://localhost:50051",
  auth: { type: "bearer", token: "your-token" }
})

// List available flights
for await (const info of client.listFlights()) {
  console.log(info.flightDescriptor?.path)
}

// Fetch data
const flightInfo = await client.getFlightInfo({ type: "path", path: ["my", "dataset"] })
const ticket = flightInfo.endpoint[0].ticket
const table = await decodeFlightDataToTable(client.doGet(ticket))

console.log(`Received ${table.numRows} rows`)

client.close()

Usage

FlightClient (Core Flight RPC)

import { createFlightClient, decodeFlightDataToTable } from "@qualithm/arrow-flight-client"

// Create a client
const client = createFlightClient({
  url: "http://localhost:50051",
  auth: { type: "bearer", token: "your-token" }
})

// List available flights
for await (const info of client.listFlights()) {
  console.log(info.flightDescriptor?.path)
}

// Fetch data
const flightInfo = await client.getFlightInfo({ type: "path", path: ["my", "dataset"] })
const ticket = flightInfo.endpoint[0].ticket
const table = await decodeFlightDataToTable(client.doGet(ticket))

console.log(`Received ${table.numRows} rows`)

// Clean up
client.close()

FlightSqlClient (SQL Operations)

import { createFlightSqlClient } from "@qualithm/arrow-flight-client"

const client = createFlightSqlClient({
  url: "http://localhost:50051",
  auth: { type: "bearer", token: "your-token" }
})

// Execute a query
const table = await client.query("SELECT * FROM users LIMIT 10")
console.log(`Got ${table.numRows} rows`)

// Stream large results
for await (const batch of client.queryBatches("SELECT * FROM large_table")) {
  console.log(`Batch: ${batch.numRows} rows`)
}

// Prepared statements
const stmt = await client.prepare("SELECT * FROM users WHERE id = ?")
const result = await client.executePrepared(stmt)
await client.closePreparedStatement(stmt)

// Transactions
const txn = await client.beginTransaction()
try {
  await client.executeUpdate("INSERT INTO users (name) VALUES ('Alice')", {
    transactionId: txn.id
  })
  await client.commit(txn)
} catch {
  await client.rollback(txn)
}

// Database metadata
const catalogs = await client.getCatalogs()
const schemas = await client.getDbSchemas({})
const tables = await client.getTables({})

client.close()

Authentication

Bearer Token

const client = createFlightClient({
  url: "https://flight-server:50051",
  auth: { type: "bearer", token: "your-api-token" }
})

Basic Auth (Flight Handshake)

const client = createFlightClient({
  url: "https://flight-server:50051",
  auth: {
    type: "basic",
    credentials: { username: "user", password: "pass" }
  }
})

// Authenticate (performs Flight Handshake RPC)
await client.authenticate()

mTLS

import { readFileSync } from "node:fs"

const client = createFlightClient({
  url: "https://flight-server:50051",
  tls: {
    ca: readFileSync("ca.pem"),
    cert: readFileSync("client.pem"),
    key: readFileSync("client-key.pem")
  }
})

Arrow IPC Utilities

import {
  encodeTableToFlightData,
  decodeFlightDataToTable,
  decodeFlightDataStream
} from "@qualithm/arrow-flight-client"
import { tableFromArrays } from "apache-arrow"

// Create Arrow data
const table = tableFromArrays({
  id: Int32Array.from([1, 2, 3]),
  name: ["Alice", "Bob", "Charlie"]
})

// Encode for upload
const flightData = encodeTableToFlightData(table)

// Decode a stream
const receivedTable = await decodeFlightDataToTable(flightDataStream)

// Stream batches
for await (const batch of decodeFlightDataStream(flightDataStream)) {
  console.log(`Batch: ${batch.numRows} rows`)
}

Error Handling

import {
  FlightError,
  FlightConnectionError,
  FlightAuthError,
  FlightServerError,
  FlightTimeoutError
} from "@qualithm/arrow-flight-client"

try {
  await client.query("SELECT * FROM users")
} catch (error) {
  if (FlightConnectionError.isError(error)) {
    console.error("connection failed:", error.message)
  } else if (FlightAuthError.isError(error)) {
    console.error("authentication failed:", error.message)
  } else if (FlightServerError.isError(error)) {
    console.error("server error:", error.message)
  } else if (FlightTimeoutError.isError(error)) {
    console.error("request timed out:", error.message)
  } else if (FlightError.isError(error)) {
    console.error("flight error:", error.message)
  }
}

API Reference

Full API documentation is generated with TypeDoc:

bun run docs
# Output in docs/

Examples

See the examples/ directory for runnable examples:

| Example | Description | | ------------------------------------------------------- | ------------------------------ | | flight-client.ts | FlightClient operations | | flight-sql-client.ts | FlightSqlClient SQL operations |

bun run examples/flight-client.ts

Development

Prerequisites

  • Bun (recommended), Node.js 20+, or Deno

Setup

bun install

Building

bun run build

Testing

bun run test              # unit tests
bun run test:integration  # integration tests (requires Flight server)
bun run test:coverage     # with coverage report

Linting & Formatting

bun run lint
bun run format
bun run typecheck

Benchmarks

bun run bench      # Server benchmarks (requires Flight server)
bun run bench:ipc  # Arrow IPC benchmarks

Publishing

The package is automatically published to NPM when CI passes on main. Update the version in package.json before merging to trigger a new release.

Licence

Apache-2.0