UNPKG

@visulima/fs

Version:

Human friendly file system utilities for Node.js

16 lines (12 loc) 631 B
'use strict'; const yaml = require('yaml'); const readFile = require('./readFile-iFUhZHnh.cjs'); 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" ? yaml.parse(content, reviver, parseOptions) : yaml.parse(content, parseOptions); } __name(readYaml, "readYaml"); module.exports = readYaml;