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

@punitarani/fli

v0.0.3

Published

TypeScript port of the fli library: programmatic access to Google Flights data through direct API interaction.

Readme

fli (TypeScript)

A 1:1 TypeScript / JavaScript port of the Python fli library.

Programmatic access to Google Flights data via direct API interaction (no scraping). The API surface mirrors the Python package — same models, same filter encoding, same wire-format decoders.

Install

bun add @punitarani/fli   # or: npm install @punitarani/fli / pnpm add @punitarani/fli

Quick start

import {
  Airport,
  FlightSearchFilters,
  FlightSegment,
  MaxStops,
  PassengerInfo,
  SearchFlights,
  SeatType,
  SortBy,
} from "@punitarani/fli";

const filters = new FlightSearchFilters({
  passenger_info: { adults: 1, children: 0, infants_in_seat: 0, infants_on_lap: 0 },
  flight_segments: [
    new FlightSegment({
      departure_airport: [[[Airport.JFK, 0]]],
      arrival_airport: [[[Airport.LAX, 0]]],
      travel_date: "2026-12-25",
    }),
  ],
  seat_type: SeatType.ECONOMY,
  stops: MaxStops.NON_STOP,
  sort_by: SortBy.CHEAPEST,
});

const results = await new SearchFlights().search(filters, { currency: "USD" });
console.log(results);

Date-range search

import { Airport, DateSearchFilters, FlightSegment, SearchDates } from "@punitarani/fli";

const filters = new DateSearchFilters({
  passenger_info: { adults: 1, children: 0, infants_in_seat: 0, infants_on_lap: 0 },
  flight_segments: [
    new FlightSegment({
      departure_airport: [[[Airport.JFK, 0]]],
      arrival_airport: [[[Airport.LAX, 0]]],
      travel_date: "2026-12-01",
    }),
  ],
  from_date: "2026-12-01",
  to_date: "2026-12-31",
});

const dates = await new SearchDates().search(filters);

HTTP / proxy configuration

The TypeScript port uses native fetch (Bun's built-in) and replaces curl_cffi's TLS impersonation with:

  • realistic Chrome User-Agent + Sec-CH-* headers,
  • automatic rate-limiting at 10 req/s,
  • 3-attempt exponential backoff on transient errors,
  • proxy support via the HTTPS_PROXY / HTTP_PROXY env vars (or via the explicit proxy option on new Client({...})).
import { Client, SearchFlights } from "@punitarani/fli";

const search = new SearchFlights(
  new Client({ proxy: "http://user:[email protected]:8080" }),
);

Set the per-request timeout with FLI_TIMEOUT=30 (seconds) or via the timeoutMs option on new Client({...}).

Modules

  • fli/modelsAirport, Airline, FlightSearchFilters, DateSearchFilters, FlightSegment, FlightResult, BookingOption, all enums.
  • fli/core — string-to-enum parsers, segment builders, airport search, currency token decoders.
  • fli/searchSearchFlights, SearchDates, Client, error classes, protobuf token helpers (buildBookingToken, extractBookingTokenFromTfu).

Development

bun install
bun run generate:enums   # regenerate airport.ts / airline.ts from data/*.csv
bun run typecheck
bun run lint             # biome + oxlint
bun run format           # biome format
bun test                 # unit + integration tests (no network)
bun run test:e2e         # live tests (FLI_E2E=1; talks to Google Flights)
bun run ci               # format-check + lint + typecheck + tests

Parity with the Python library

The TypeScript port preserves byte-perfect wire compatibility with the Python upstream:

  • FlightSearchFilters.format() produces structurally identical nested-list payloads (see tests/integration/filter_format_snapshots.test.ts).
  • buildBookingToken(...) reproduces a captured live booking-page token byte-for-byte (see tests/search/proto.test.ts).
  • The wire-format parser handles both the legacy single-chunk JSONP shape and the multi-chunk format used by GetBookingResults.

License

MIT — same as the upstream Python project.