@dpkit/file
Version:
Fast TypeScript data management framework built on top of the Data Package standard and Polars DataFrames
16 lines (12 loc) • 439 B
text/typescript
import { prefetchFile } from "./fetch.ts"
import { inferFileBytes, inferFileHash } from "./infer.ts"
import type { HashType } from "./infer.ts"
export async function describeFile(
path: string,
options?: { hashType?: HashType },
) {
const localPath = await prefetchFile(path)
const bytes = await inferFileBytes(localPath)
const hash = await inferFileHash(localPath, { hashType: options?.hashType })
return { bytes, hash }
}