4.0.1 • Published 5 years ago

node-yaml v4.0.1

Weekly downloads
42,411
License
MIT
Repository
github
Last release
5 years ago

Node YAML

A wrapper for js-yaml parser

dependencies Status devDependencies Status Build Status Code Coverage

This documentation is actual for next major version of the library. If you want the documentation of current stable version, please check out the 3.x branch.

Installation

You can install this module from Yarn:

yarn add node-yaml js-yaml

Or using NPM:

npm install node-yaml js-yaml

Usage

  1. Let's read some file from given path using node-yaml:
import {read} from "node-yaml"

read("path/to/file.yaml")
  .then(res => console.log("File content:\n\n%s", JSON.stringify(res, null, 2)))
  .catch(err => console.error("Error while reading file:\n\n%s", String(err)))
  1. Both read and readSync methods allows to omit file extension:
import {readSync} from "node-yaml"

// Will read the content from given path, but also resolve file extension
// Note that if you have 2 files with the same name,
// the first matched will be read.
readSync("path/to/file")

API

yaml.read(filename[, options]) -> {Promise<object>}

Read and parse YAML file from given path. Takes following arguments:

  • {string | number} filename – path to file or a file descriptor. Path can omit the file extension.
  • {object} {options = undefined} – reading options
yaml.readSync(filename[, options]) -> {object}

Synchronous version of yaml.read

yaml.write(filename, object[, options]) -> {Promise<void>}

Write given YAML content to disk. Takes following arguments:

  • {string | number} filename – path to file or a file descriptor. Path can omit the file extension.
  • {object} object – a content to write to the file
  • {object} {options = undefined} – writing options
yaml.writeSync(filename, object[, options]) -> {void}

Synchronous version of yaml.write

@hubiinetwork/nahmii-clidepth-coverageaz-depth-coverage@dxos/pad-cli@dxos/xbox-cli@dxos/xbox-dashboard@dxos/cli-xbox@dxos/dashboard-cli@dxos/cli-dashboard@dxos/app-cli@dxos/bot-cli@45air/air-local-docker@infinitebrahmanuniverse/nolb-node-y@everything-registry/sub-chunk-2320drkn-localeember-test-utilsdw-azure-tools-sdk-generation-libfleishmanfatturolajsgraphcool-composehatimeria-hathomestead-sitesgenerator-openapi-repogenerator-garlic-webappgitrestutilgenerator-toolboxgraphql-gen-requesthadron-i18ngy2hjson-dereference-clilando-plugin-anywheremdtknanobox-dbnahmii-climandarina-cli@lidcore/dracomongo-oplog-s3-backuppokemojiprebuilt-cliprebuilt-core@pingsrl/nanotools@movenium/blocksnimbu-toolbelt@nimbu-cli/commandnode-m17n@qiaozha/fakesdkprotodoc-serverolympusopenapi-flattenernygmax.applicationsoctoblu3po@bitblit/paratrade-common@wamongo/server@wangjiang988/easycode@wirelineio/registry-cli@wirelineio/sdk@wirelineio/util-node@wirelineio/wns-cli@wirelineio/cli@wirelineio/cli-bot@wirelineio/cli-pad@wirelineio/cli-protocol@wirelineio/cli-wns@wirelineio/console-cli@wirelineio/botkit@beauknows/eslint-config-personalautorest-autoconfigautorest-azautorest.cliautorest.devopsatomextrefs@autorest/cli.common@autorest/clicommon@autorest/gotest@autorest/test@autorest/az@autorest/cliappajsappengine-config@azure-tools/sdk-generation-lib@xrosy/generator@yuangwang/astrobuildadapter@yuangwang/buildadaptorplayground@vvsalmin/blocks@silphid/gpm@tmbi/air-local-dockerpublish-sdkcodgen-pipeline-resultribamarsaltfish-botrun-in-iterm2sactive-bot@danmasta/deploystriim-clistriim-sdk@datacamp/mobile-teachcherry-treecodegenapp
4.0.1

5 years ago

4.0.0

5 years ago

3.2.0

5 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.0.1

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago