UNPKG

@stryke/fs

Version:

A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.

28 lines (26 loc) 810 B
import { readFile, readFileSync } from "./read-file.mjs"; import { parse } from "yaml"; //#region src/yaml.ts /** * Reads a YAML file and returns the object the YAML content represents. * * @param path - A path to a file. * @param options - YAML parse options * @returns Object the YAML content of the file represents */ function readYamlFileSync(path, options) { return parse(readFileSync(path), options); } /** * Reads a YAML file and returns the object the YAML content represents. * * @param path - A path to a file. * @param options - YAML parse options * @returns Object the YAML content of the file represents */ async function readYamlFile(path, options = {}) { return parse(await readFile(path), options); } //#endregion export { readYamlFile, readYamlFileSync }; //# sourceMappingURL=yaml.mjs.map