Skip to content

Search the guides, deployment pages, and API reference.

file

import { file } from "@pitlane/content/loaders";
function file(fileName, options?): ContentLoader;

Reads one file holding many entries.

Every entry is data rather than a document: a file of records has no body to render, so render() on one of these entries is a mistake and says so.

The file holds either an object whose keys are entry ids or an array of entries that each carry an id. .json, .yaml, and .yml parse without options; any other format needs options.parser, which turns the file's text into that object or array.

Parameters

fileName

string

options?

parser?

(text: string) => unknown

Returns

ContentLoader

See

Content guide