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

read-js-yaml

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-js-yaml

A wrapper around `js-yaml` to read local or remote YAML and optionally return JSON

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25
increased by92.31%
Maintainers
1
Weekly downloads
 
Created
Source

read-js-yaml

A wrapper around js-yaml to read local or remote YAML and optionally return JSON

Installation

npm install read-js-yaml

Usage

import readJsYaml from 'read-js-yaml';

// read from local directory returns JSON
const json = await readJsYaml("./src/__tests__/__stubs__/bookmarks.yaml")
// read from local directory returns YAML
const yaml = await readJsYaml("https://raw.githubusercontent.com/thearegee/bookworms/main/demo/config/bookmarks.yaml", true)

There is one default function you can use from read-js-yaml.

readJsYaml(path, asYaml)

readJsYaml works as an asynconous function that takes two parameters:

  • path - Required can be the path to a local YAML or remote YAML file
  • asYaml - optional boolean value defaults to false, if set to true returns YAML as a string else the requested YAML is returned as JSON

NOTE: If something goes wrong like the file can't be found or returns a non 2xx the function will throw an error.

Keywords

FAQs

Package last updated on 28 Oct 2022

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