@queria-io/fdl-js

中文文档
0.1.0发布于 2026/11/02MITTypeScriptES Module

Read DuckLake tables published as FDL repositories, without DuckDB: resolve refs, list a version's files and read Parquet by range

原始使用文档
文档目录6 节
  1. Install
  2. Use
  3. Stores
  4. Caching
  5. What it follows
  6. Develop

fdl-js

Read DuckLake tables published as FDL repositories from JavaScript, without DuckDB: resolve a ref to a version, list the data files of its tables from files.json, and read the Parquet files by range with hyparquet. It runs in Cloudflare Workers, browsers and Node.

It reads; it does not write. It reads only tables whose files can be read as they are: a table with deleted rows or renamed columns is refused, since reading its Parquet files without the catalog would return deleted rows or miss columns. Read those with DuckDB.

Install

npm install @queria-io/fdl-js

It is an ES module with type definitions, for Node 20 or later and any bundler.

Use

import { httpStore, open, openParquet, readWhere, tableFiles } from "@queria-io/fdl-js";

const store = httpStore("https://data.example.org/towns/");
const version = await open(store); // HEAD, or open(store, "2025-final"), or a version ID
const [file] = tableFiles(version, "main.town") ?? [];
const parquet = await openParquet(store, file);
const rows = await readWhere(parquet, "lg_code", "131016", ["name"]);

readWhere reads only the row groups whose min/max can hold the value, so it reads little from files sorted by that column.

Stores

A store is where the repository's root is. Keys are the layout's paths (fdl.json, refs/heads/main, versions/<ID>/files.json, data/...).

StoreReads from
httpStore(root, { fetch, headers })A URL, with Range requests
r2Store(bucket, prefix)An R2 binding in Workers
fileStore(dir) from @queria-io/fdl-js/nodeA local folder

Each retries a failed request once. A store is three functions (text, size, range), so another one is a few lines.

Caching

  • Refs move. refreshing(() => open(store), 5 * 60_000) keeps the version for five minutes and keeps the last one when a ref cannot be read for a moment
  • Data files never change, so their footers can be kept forever: pass { cache: cacheApiFooterCache(caches.default) } (Workers) or memoryFooterCache() to openParquet. With footer_bytes in files.json, an uncached footer is one read

What it follows

Reading in the specification: HEAD and refs are followed, version.json must name its own ID and a known fdl major version, a version with expired.json is refused, and file paths from files.json are read under data_dir. A version without files.json cannot be read with this library.

Develop

pnpm install
pnpm test
pnpm typecheck
pnpm check
pnpm build       # dist/

To release, set version in package.json in a pull request, merge it, and push the tag v<version>. The Release workflow publishes it to npm.

test/fixture/repo is a small repository made by the fdl command: FDL=fdl test/make-fixture.sh remakes it.

版本与发布记录

@queria-io/fdl-js 共发布 2 个版本,首次发布于 2026/11/02;过去 12 个月发布了 2 个版本。

版本发布日期距今
0.1.0latest2026/11/021 天前
0.0.0-stage2026/11/021 天前

关于 @queria-io/fdl-js 的常见问题

@queria-io/fdl-js 是什么?

读取作为FDL存储库发布的DuckLake表,没有DuckDB: resolve refs,列出一个版本的文件并按范围读取Parquet

如何安装 @queria-io/fdl-js?

在项目目录运行 npm install @queria-io/fdl-js,或使用 pnpm add / yarn add / bun add。

@queria-io/fdl-js 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@queria-io/fdl-js 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@queria-io/fdl-js 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@queria-io/fdl-js 可以商用吗?

@queria-io/fdl-js 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@queria-io/fdl-js 还在维护吗?

最新版本 0.1.0 发布于 2026/11/02(1 天前);至今共发布 2 个版本,其中过去 12 个月发布了 2 个;首次发布于 2026/11/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。