Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

read-yaml-file

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-yaml-file

Read and parse a YAML file

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1M
decreased by-10.09%
Maintainers
1
Weekly downloads
 
Created

What is read-yaml-file?

The read-yaml-file npm package is a simple utility for reading YAML files and converting them into JavaScript objects. It is useful for configuration files, data storage, and other scenarios where YAML is preferred over JSON or other formats.

What are read-yaml-file's main functionalities?

Read YAML File

This feature allows you to read a YAML file and convert its contents into a JavaScript object. The function returns a promise that resolves with the parsed data or rejects with an error.

const readYamlFile = require('read-yaml-file');

readYamlFile('path/to/file.yaml').then(data => {
  console.log(data);
}).catch(error => {
  console.error(error);
});

Synchronous Read

This feature provides a synchronous method to read a YAML file. It immediately returns the parsed data or throws an error if the file cannot be read.

const readYamlFile = require('read-yaml-file');

try {
  const data = readYamlFile.sync('path/to/file.yaml');
  console.log(data);
} catch (error) {
  console.error(error);
}

Other packages similar to read-yaml-file

Keywords

FAQs

Package last updated on 09 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc