UNPKG

@favware/yamlreader

Version:

Minimal wrapper around js-yaml for directly reading in YAML files

24 lines 900 B
import { DumpOptions } from 'js-yaml'; /** FS Options */ export interface FsOptions { encoding?: 'utf8' | 'ascii' | 'utf16le' | 'ucs2' | 'base64' | 'latin1' | 'binary' | 'hex'; flag?: string; } /** * YAMLReaderOptions for configuring both `fs` and `js-yaml` * See {@link https://github.com/nodeca/js-yaml#safeload-string---options- | js-yaml configuration} and {@link FsOptions} for details */ export declare type YamlReaderOptions = DumpOptions & FsOptions; /** * Reads a YAML file and outputs a JavaScript object * * @param filepath Path to the yaml file to parse * @param options Options for the YAML parser and fs file reader * @example * ```ts * const data = readYaml('/path/to/some/yaml/file'); * ``` */ export declare const readYaml: <T = unknown>(filepath: string, options?: YamlReaderOptions | undefined) => T; export * from 'js-yaml'; //# sourceMappingURL=index.d.ts.map