@stryke/fs
Version:
A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.
33 lines (31 loc) • 1.02 kB
JavaScript
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
import { readFile, readFileSync } from "./read-file.mjs";
import { parse } from "yaml";
//#region src/yaml.ts
var yaml_exports = /* @__PURE__ */ __exportAll({
readYamlFile: () => readYamlFile,
readYamlFileSync: () => readYamlFileSync
});
/**
* 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, yaml_exports };
//# sourceMappingURL=yaml.mjs.map