UNPKG

dpkit

Version:

Fast TypeScript data management framework built on top of the Data Package standard and Polars DataFrames

18 lines (14 loc) 524 B
import { loadPackageDescriptor } from "@dpkit/core" import { dpkit } from "../general/index.js" export async function loadPackage(source: string) { for (const plugin of dpkit.plugins) { const result = await plugin.loadPackage?.(source) if (result) return result } if (source.endsWith("datapackage.json")) { const cleanup = async () => {} const dataPackage = await loadPackageDescriptor(source) return { dataPackage, cleanup } } throw new Error(`No plugin can load the package: ${source}`) }