UNPKG

@visulima/fs

Version:

Human friendly file system utilities for Node.js

11 lines (8 loc) 446 B
import { parse } from 'yaml'; import readFile from './readFile-BcK0rkht.js'; async function readYaml(path, reviver, options) { const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {}; const content = await readFile(path, { buffer, compression, encoding, flag }); return typeof reviver === "function" ? parse(content, reviver, parseOptions) : parse(content, parseOptions); } export { readYaml as default };