{"id":31753719,"url":"https://github.com/servicenow/dir_lines_streamer","last_synced_at":"2025-10-09T17:53:54.196Z","repository":{"id":57619663,"uuid":"164898496","full_name":"ServiceNow/dir_lines_streamer","owner":"ServiceNow","description":"Rust crate allowing reading files inside a directory line-by-line, one file after the other (in human-alphabetical order). dir_lines_streamer is a ServiceNow Research project that was started at Element AI.","archived":false,"fork":false,"pushed_at":"2022-07-15T17:39:40.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-18T11:27:37.627Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crates.io/crates/dir_lines_streamer","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ServiceNow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-09T16:29:20.000Z","updated_at":"2024-04-18T12:38:38.000Z","dependencies_parsed_at":"2022-09-19T11:00:29.048Z","dependency_job_id":null,"html_url":"https://github.com/ServiceNow/dir_lines_streamer","commit_stats":null,"previous_names":["elementai/dir_lines_streamer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ServiceNow/dir_lines_streamer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceNow%2Fdir_lines_streamer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceNow%2Fdir_lines_streamer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceNow%2Fdir_lines_streamer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceNow%2Fdir_lines_streamer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ServiceNow","download_url":"https://codeload.github.com/ServiceNow/dir_lines_streamer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceNow%2Fdir_lines_streamer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001805,"owners_count":26083197,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-09T17:53:49.763Z","updated_at":"2025-10-09T17:53:54.191Z","avatar_url":"https://github.com/ServiceNow.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"*ServiceNow completed its acquisition of Element AI on January 8, 2021. All references to Element AI in the materials that are part of this project should refer to ServiceNow.*\n\n# dir_lines_streamer\n\n`dir_lines_streamer` is a Rust crate allowing reading files inside a directory line-by-line,\none file after the other (in human-alphabetical order).\n\n```toml\n# Cargo.toml\n[dependencies]\ndir_lines_streamer = \"0.1\"\n```\n\n## Example\n\nLet's say you have a directory containing files split by logrotate that you want to read line-by-line:\n\n```sh\nls fixtures/non-empty-dir/\nmessages        messages.1      messages.10     messages.2      messages.20\n```\n\nNote how the alphabetical ordering sorts `messages.10` before `messages.2`.\n\nThis crate allows creating a structure that implements the trait `Iterator\u003cItem = String\u003e`\nwhich returns the lines of the files.\n\n```rust\nuse failure; // Crate failure 0.1\nuse dir_lines_streamer::DirectoryLinesStreamer;\n\nlet streamer_result: Result\u003cDirectoryLinesStreamer, failure::Error\u003e = DirectoryLinesStreamer::from_dir(\"fixtures/non-empty-dir\");\n\n// Read all lines of all files inside the directory and store them in a Vec\u003cString\u003e\nlet lines: Vec\u003cString\u003e = streamer.collect();\n\nprintln!(\"lines: {:#?}\", lines);\n```\n\nThis will print:\n\n```text\nlines: [\n    \"line one from messages\\n\",\n    \"line two from messages\\n\",\n    \"line three from messages\\n\",\n    \"line one from messages.1\\n\",\n    \"line two from messages.1\\n\",\n    \"line three from messages.1\\n\",\n    \"line one from messages.2\\n\",\n    \"line two from messages.2\\n\",\n    \"line three from messages.2\\n\",\n    \"line one from messages.10\\n\",\n    \"line two from messages.10\\n\",\n    \"line three from messages.10\\n\",\n    \"line one from messages.20\\n\",\n    \"line two from messages.20\\n\",\n    \"line three from messages.20\\n\"\n]\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\nCopyright (c) Element AI Inc., 2018, by Nicolas Bigaouette. All rights reserved.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservicenow%2Fdir_lines_streamer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fservicenow%2Fdir_lines_streamer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservicenow%2Fdir_lines_streamer/lists"}