{"id":15699166,"url":"https://github.com/andostronaut/yaml-extra","last_synced_at":"2025-05-09T02:22:27.761Z","repository":{"id":65008321,"uuid":"579575343","full_name":"andostronaut/yaml-extra","owner":"andostronaut","description":"YAML: extra contains method such read(), write()","archived":false,"fork":false,"pushed_at":"2023-07-07T03:53:21.000Z","size":581,"stargazers_count":7,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-05T08:57:29.677Z","etag":null,"topics":["load","read","write","yaml","yaml-content","yaml-files","yaml-parser","yaml-processor"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/yaml-extra","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andostronaut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-18T06:20:49.000Z","updated_at":"2025-01-01T01:39:40.000Z","dependencies_parsed_at":"2024-05-31T18:42:08.627Z","dependency_job_id":null,"html_url":"https://github.com/andostronaut/yaml-extra","commit_stats":null,"previous_names":["andostronaut/yaml-extra","iamando/yaml-extra"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andostronaut%2Fyaml-extra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andostronaut%2Fyaml-extra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andostronaut%2Fyaml-extra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andostronaut%2Fyaml-extra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andostronaut","download_url":"https://codeload.github.com/andostronaut/yaml-extra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253176677,"owners_count":21866186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["load","read","write","yaml","yaml-content","yaml-files","yaml-parser","yaml-processor"],"created_at":"2024-10-03T19:38:46.890Z","updated_at":"2025-05-09T02:22:27.680Z","avatar_url":"https://github.com/andostronaut.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yaml: extra\n\n![build](https://github.com/iamando/yaml-extra/workflows/build/badge.svg)\n![license](https://img.shields.io/github/license/iamando/yaml-extra?color=success)\n![npm](https://img.shields.io/npm/v/yaml-extra)\n![release](https://img.shields.io/github/release-date/iamando/yaml-extra)\n\n`yaml-extra` contains methods such read(), write() that you can use easily to write or read a yaml file.\n\n## Installation\n\n```bash\nnpm install yaml-extra\n```\n\n## Usage\n\n### CommonJS\n\n```js\nconst ye = require('yaml-extra')\n```\n\n### ESM\n\nThere is also an `yaml-extra/esm` import, that supports both default and named exports.\n\n```js\nimport { write, writeSync } from 'yaml-extra/esm'\n```\n\nDefault exports are supported:\n\n```js\nimport ye from 'yaml-extra/esm'\n```\n\n## Sync vs Async vs Async/Await\n\nMost methods are async by default. All async methods will return a promise if the callback isn't passed.\n\nSync methods on the other hand will throw if an error occurs.\n\nAlso Async/Await will throw an error if one occurs.\n\nExample:\n\n```js\nconst ye = require('yaml-extra')\nconst path = require('path')\n\n// Use path join for file path\nconst filePath = path.join(__dirname, 'file.yaml')\n\n// Async with promises:\nye.write(filePath, { foo: 'bar' })\n  .then((doc) =\u003e console.log(doc))\n  .catch((err) =\u003e console.error(err))\n\n// Async with callbacks:\nye.write(\n  filePath,\n  { foo: 'bar' },\n  (doc) =\u003e {\n    console.log(doc)\n  },\n  (err) =\u003e {\n    console.error(err)\n  }\n)\n\n// Sync:\ntry {\n  const doc = ye.writeSync(filePath, { foo: 'bar' })\n  console.log(doc)\n} catch (err) {\n  console.error(err)\n}\n\n// Async/Await:\nasync function writeFile() {\n  try {\n    const doc = await ye.write(filePath, { foo: 'bar' })\n    console.log(doc)\n  } catch (err) {\n    console.error(err)\n  }\n}\n\nwriteFile()\n```\n\n## Methods\n\nAsync\n\n- [read](docs/read.md)\n- [write](docs/write.md)\n\nSync\n\n- [readSync](docs/read-sync.md)\n- [writeSync](docs/write-sync.md)\n\n## Support\n\nyaml-extra is an MIT-licensed open source project. It can grow thanks to the sponsors and support.\n\n## License\n\nyaml-extra is [MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandostronaut%2Fyaml-extra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandostronaut%2Fyaml-extra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandostronaut%2Fyaml-extra/lists"}