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: about 1 month 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.
- Host: GitHub
- URL: https://github.com/jaid/read-file-yaml
- Owner: Jaid
- License: mit
- Created: 2019-12-19T21:30:09.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T04:38:33.000Z (about 3 years ago)
- Last Synced: 2025-01-26T07:32:37.930Z (over 1 year ago)
- Topics: file, filesystem, fs, lib, library, loader, promise, read-file, read-yaml, util, utility, yaml, yaml-parser, yml, yml-parser
- Language: JavaScript
- Homepage: https://github.com/Jaid/read-file-yaml
- Size: 4.76 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license.txt
Awesome Lists containing this project
README
# 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.**
## Installation
```bash
npm install --save read-file-yaml@^2.0.0
```
```bash
yarn add read-file-yaml@^2.0.0
```
(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 git@github.com: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)