# load-yaml-file

> Read and parse a YAML file.

Latest version **1.0.0** (published 2021-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install load-yaml-file
pnpm add load-yaml-file
yarn add load-yaml-file
bun add load-yaml-file
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-08-21 |
| First published | 2016-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 3 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | linusu |

## Links

- npm: https://www.npmjs.com/package/load-yaml-file
- Repository: https://github.com/LinusU/load-yaml-file
- Homepage: https://github.com/LinusU/load-yaml-file#readme
- Issues: https://github.com/LinusU/load-yaml-file/issues
- npm.io page: https://npm.io/package/load-yaml-file

## Dependencies (3)

- [js-yaml](https://npm.io/package/js-yaml.md) ^4.1.0
- [strip-bom](https://npm.io/package/strip-bom.md) ^5.0.0
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.2.8

## Recent versions

- 1.0.0 (latest) — 2021-08-21
- 0.2.0 — 2019-04-05
- 0.1.1 — 2019-04-05
- 0.1.0 — 2016-08-10

## README

# Load YAML file

Read and parse a YAML file.

## Installation

```sh
npm install --save load-yaml-file
```

## Usage

```js
import { loadYamlFile } from 'load-yaml-file'

const data = await loadYamlFile('foo.yml')
console.log(data)
//=> {foo: true}
```

### Sync

```js
import { loadYamlFileSync } from 'load-yaml-file'

const data = loadYamlFileSync('foo.yml')
console.log(data)
//=> {foo: true}
```

## API

### `loadYamlFile(path)`

- `path` (`string | Buffer | URL`, required)
- returns `Promise<unknown>` - a promise for the parsed YAML

### `loadYamlFileSync(path)`

- `path` (`string | Buffer | URL`, required)
- returns `unknown` - the parsed YAML

## Related

- [write-yaml-file](https://github.com/zkochan/write-yaml-file) - Stringify and write YAML to a file atomically
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file

---
_Source: https://npm.io/package/load-yaml-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
