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-2320workfloosews-servicexianyu-robotsactive-botsaltfish-botribamarswaggy-jenkins-clitext-dep@danmasta/deploygraphql-gen-requestgitrestutilmongo-oplog-s3-backuphatimeria-hatgraphcool-composehadron-i18ngy2hjson-dereference-clihomestead-siteslajslando-plugin-anywheremandarina-climdtkopenapi-flattenerprebuilt-cliprebuilt-coreprotodoc-serverpublish-sdkcodgen-pipeline-resultpokemojioctobluolympusnode-m17nnimbu-toolbeltnahmii-clinanobox-dbnygmax.applicationsrefsstatic-httpdstriim-clistriim-sdkrun-in-iterm2skyway-signaling-gatewaytomtaw-cli@autorest/gotest@autorest/test@autorest/az@autorest/cli@autorest/cli.common@autorest/clicommon@azure-tools/sdk-generation-lib@beauknows/eslint-config-personal@bitblit/paratrade-common@cloud-node/server3po@datawheel/canon-cmsyaml-extrawebmatrix@dxos/cli-bot@dxos/cli-console@dxos/cli-core@gigster/gig-utils@lidcore/draco@movenium/blocks@nimbu-cli/command@dxos/cli-pad@dxos/cli-wns@qiaozha/fakesdk@pingsrl/nanotools@snowballtools/laconic-sdk@silphid/gpm@datacamp/mobile-teach@tmbi/air-local-docker@wirelineio/registry-cli@wirelineio/sdk@wirelineio/util-node@wirelineio/wns-cli@wirelineio/console-cli@wirelineio/botkit@wirelineio/cli@wirelineio/cli-bot@wirelineio/cli-pad@wirelineio/cli-protocol@wirelineio/cli-wns@wamongo/server@wangjiang988/easycode@vvsalmin/blocks@yuangwang/astrobuildadapter
4.0.1

5 years ago

4.0.0

6 years ago

3.2.0

6 years ago

3.1.1

7 years ago

3.1.0

8 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

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago