Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/jaid/read-file-yaml
- Owner: Jaid
- License: mit
- Created: 2019-12-19T21:30:09.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T04:38:33.000Z (almost 2 years ago)
- Last Synced: 2024-12-17T03:23:25.725Z (17 days 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 [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)