Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jaid/read-file-yaml

Reads YAML 1.2 from a file. Returns null if file does not exist (or is a directory) instead of throwing an Error.
https://github.com/jaid/read-file-yaml

file filesystem fs lib library loader promise read-file read-yaml util utility yaml yaml-parser yml yml-parser

Last synced: 8 days ago
JSON representation

Reads YAML 1.2 from a file. Returns null if file does not exist (or is a directory) instead of throwing an Error.

Awesome Lists containing this project

README

        

# read-file-yaml

License Sponsor read-file-yaml
Build status Commits since v2.0.0 Last commit Issues
Latest version on npm Dependents Downloads

**Reads YAML 1.2 from a file. Returns null if file does not exist (or is a directory) instead of throwing an Error.**

## Installation

read-file-yaml on npm

```bash
npm install --save read-file-yaml@^2.0.0
```

read-file-yaml on Yarn

```bash
yarn add read-file-yaml@^2.0.0
```

@jaid/read-file-yaml on GitHub Packages
(if [configured properly](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-npm-for-use-with-github-packages))

```bash
npm install --save @jaid/read-file-yaml@^2.0.0
```

## Example

```javascript
import readFileYaml from "read-file-yaml"

readFileYaml("./exists.yml").then(result => {

})

readFileYaml("./doesNotExist.yml").then(result2 => {

})
```

Variable `result` will be:

```javascript
["a", "b", "c"]
```
Variable `result2` will be:

```javascript
null
```

## Development

Setting up:
```bash
git clone [email protected]:jaid/read-file-yaml.git
cd read-file-yaml
npm install
```
Testing:
```bash
npm run test:dev
```
Testing in production environment:
```bash
npm run test
```

## License
[MIT License](https://raw.githubusercontent.com/jaid/read-file-yaml/master/license.txt)
Copyright © 2020, Jaid \ (https://github.com/jaid)