@visulima/fs
Version:
Human friendly file system utilities for Node.js
14 lines (11 loc) • 606 B
JavaScript
import { parse } from 'yaml';
import readFile from './readFile-b7UBVv17.mjs';
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
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);
}
__name(readYaml, "readYaml");
export { readYaml as default };