Installations
npm install node-read-yaml
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=8.6.0
Node Version
10.21.0
NPM Version
6.14.6
Score
54.6
Supply Chain
97.1
Quality
75.2
Maintenance
100
Vulnerability
100
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
dailyrandomphoto
Download Statistics
Total Downloads
61,078
Last Day
44
Last Week
206
Last Month
775
Last Year
11,629
GitHub Statistics
1 Stars
9 Commits
1 Forks
1 Watching
5 Branches
1 Contributors
Bundle Size
197.02 kB
Minified
47.97 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.1
Package Id
node-read-yaml@1.0.1
Unpacked Size
7.75 kB
Size
3.00 kB
File Count
4
NPM Version
6.14.6
Node Version
10.21.0
Total Downloads
Cumulative downloads
Total Downloads
61,078
Last day
-32.3%
44
Compared to previous day
Last week
-8%
206
Compared to previous week
Last month
8.8%
775
Compared to previous month
Last year
-12.2%
11,629
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
7
node-read-yaml
Read and parse a YAML file. A wrapper of js-yaml
read file directly.
1const read = require("node-read-yaml"); 2 3const doc = read.sync(filename); 4console.log(doc);
same as
1const fs = require("fs"); 2const yaml = require("js-yaml"); 3 4const doc = yaml.safeLoad(fs.readFileSync(filename, "utf8")); 5console.log(doc);
Installation
1npm install node-read-yaml
API
read (filename [ , options ]) | read.sync (filename [ , options ])
Read a YAML file and parse content as JSON. Returns either a plain object, an array, a string or undefined, or throws YAMLException on error. By default, does not support regexps, functions and undefined. This method is safe for untrusted data. more
options:
multi
(default: false) - If true, then reads file as multi-document and returns an array.onWarning
(default: null) - function to call on warning messages. Loader will call this function with an instance ofYAMLException
for each warning.schema
(default:DEFAULT_SAFE_SCHEMA
) - specifies a schema to use.FAILSAFE_SCHEMA
- only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346JSON_SCHEMA
- all JSON-supported types: http://www.yaml.org/spec/1.2/spec.html#id2803231CORE_SCHEMA
- same asJSON_SCHEMA
: http://www.yaml.org/spec/1.2/spec.html#id2804923DEFAULT_SAFE_SCHEMA
- all supported YAML types, without unsafe ones (!!js/undefined
,!!js/regexp
and!!js/function
): http://yaml.org/type/DEFAULT_FULL_SCHEMA
- all supported YAML types.
json
(default: false) - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
Examples
asynchronously read a file
1const read = require("node-read-yaml"); 2 3read("config.yml") 4 .then((doc) => console.log(doc)) 5 .catch((err) => console.error(err));
wrapper of require('js-yaml').safeLoad
asynchronously read multi-document file
1const read = require("node-read-yaml"); 2 3read("config.yml", { multi: true }) 4 .then((arr) => arr.forEach((doc) => console.log(doc))) 5 .catch((err) => console.error(err));
wrapper of require('js-yaml').safeLoadAll
synchronously read a file
1const readSync = require("node-read-yaml").sync; 2 3try { 4 const doc = readSync("config.yml"); 5 console.log(doc); 6} catch (err) { 7 console.log(err); 8}
wrapper of require('js-yaml').safeLoad
synchronously read multi-document file
1const readSync = require("node-read-yaml").sync; 2 3try { 4 const arr = readSync("config.yml", { multi: true }); 5 arr.forEach((doc) => console.log(doc)); 6} catch (err) { 7 console.log(err); 8}
wrapper of require('js-yaml').safeLoadAll
read.YAMLException
require('js-yaml').YAMLException
Related
- node-read-yaml-files - Read and parse YAML files in a directory and its subdirectories.
- js-yaml - JavaScript YAML parser and dumper. Very fast.
License
Copyright (c) 2019 dailyrandomphoto. Licensed under the MIT license.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to node-read-yaml
node-read-yaml-files
Read and parse YAML files in a directory and its subdirectories.
yaml-env-defaults
Read yaml file with environment variables substitution
@pnpm/modules-yaml
Reads/writes `node_modules/.modules.yaml`
@axway-api-builder-ext/api-builder-plugin-fn-file
File Flow-Node to read/write files as part of an API-Builder flow.