{"id":16797112,"url":"https://github.com/jdockerty/yaml-stream","last_synced_at":"2026-05-21T04:03:08.289Z","repository":{"id":65071862,"uuid":"576998276","full_name":"jdockerty/yaml-stream","owner":"jdockerty","description":"Go library for parsing multiple YAML documents in a single file, a YAML stream.","archived":false,"fork":false,"pushed_at":"2022-12-23T11:40:43.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T13:29:30.433Z","etag":null,"topics":["golang","yaml","yaml-deserialization","yaml-library","yaml-parser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdockerty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-11T16:59:16.000Z","updated_at":"2022-12-20T21:06:56.000Z","dependencies_parsed_at":"2022-12-29T21:45:35.440Z","dependency_job_id":null,"html_url":"https://github.com/jdockerty/yaml-stream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fyaml-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fyaml-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fyaml-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fyaml-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdockerty","download_url":"https://codeload.github.com/jdockerty/yaml-stream/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971157,"owners_count":20376784,"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":["golang","yaml","yaml-deserialization","yaml-library","yaml-parser"],"created_at":"2024-10-13T09:21:11.539Z","updated_at":"2026-05-21T04:03:03.247Z","avatar_url":"https://github.com/jdockerty.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YAML Stream\n\nA Go library to simplify the handling of YAML streams. These are multiple YAML files\nwhich you will see delimited with `---`, for example\n\n```yaml\nitems:\n  - 'apples'\n  - 'peaches'\nlanguage: 'go'\n---\nname: 'jack'\nmessage: 'hello world'\n```\n\n\n### Usage\n\nUsing the example YAML file provided in [`testdata/simple_stream.yaml`](testdata/simple_stream.yaml).\n\nShown below are some use cases of the library, for further details you can view the tests provided within the\n`stream_test.go` file.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/jdockerty/yaml-stream\"\n)\n\nfunc main() {\n\tys := yamlstream.New()\n\n\tys.ReadWithOpen(\"testdata/simple_stream.yaml\")\n\n\tfirstDocument := ys.Get(0)\n\n\tfmt.Println(firstDocument.String())\n\t// Outputs the YAML first document in the file\n\t// ---\n\t// stream_number: 1\n\n\tvar myMap map[string]int\n\tfirstDocument.Unmarshal(\u0026myMap)\n\n\tfmt.Println(myMap[\"stream_number\"]) // Outputs '1'\n\n\tvar secondValue map[string]int\n\tys.GetUnmarshal(1, \u0026secondValue)\n\tfmt.Println(secondValue[\"stream_number\"]) // Outputs '2'\n\n}\n```\n\nWhen dealing with complex types, it is necessary to instead use a `map[string]interface{}` type or\nunmarshal into a `struct` when the schema is known in advance.\n\n#### CLI\n\nUsing this library, you can also utilise the CLI tool, available in the `cmd/ys` package, to print out the YAML document\nwhich is contained within a stream.\n\nFor example\n\n```\ngo install -v github.com/jdockerty/yaml-stream/cmd/ys@latest\n\nys -filename testdata/simple_stream.yaml\nys -filename testdata/simple_stream.yaml -index 2\n```\n\nBy default, the first document is printed at index 0. The YAML stream is treated as an array of documents.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdockerty%2Fyaml-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdockerty%2Fyaml-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdockerty%2Fyaml-stream/lists"}