{"id":18786500,"url":"https://github.com/tetsuok/swift-filestream","last_synced_at":"2025-04-13T13:07:02.154Z","repository":{"id":146612825,"uuid":"198661699","full_name":"tetsuok/swift-filestream","owner":"tetsuok","description":"File stream APIs for reading from or writing to files on Linux and macOS","archived":false,"fork":false,"pushed_at":"2019-07-31T16:38:59.000Z","size":26,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-13T13:06:58.030Z","etag":null,"topics":["linux","macos","swift","swift5"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/tetsuok.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":"2019-07-24T15:24:28.000Z","updated_at":"2023-05-27T08:15:57.000Z","dependencies_parsed_at":"2023-04-19T02:57:14.817Z","dependency_job_id":null,"html_url":"https://github.com/tetsuok/swift-filestream","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetsuok%2Fswift-filestream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetsuok%2Fswift-filestream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetsuok%2Fswift-filestream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetsuok%2Fswift-filestream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetsuok","download_url":"https://codeload.github.com/tetsuok/swift-filestream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717242,"owners_count":21150389,"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":["linux","macos","swift","swift5"],"created_at":"2024-11-07T20:51:43.691Z","updated_at":"2025-04-13T13:07:02.149Z","avatar_url":"https://github.com/tetsuok.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swift-filestream [![Build Status](https://travis-ci.org/tetsuok/swift-filestream.svg?branch=master)](https://travis-ci.org/tetsuok/swift-filestream)\n\nProvides efficient file stream API for reading from or writing to files on\nLinux and macOS, which is currently missing in Swift's standard library. The\ngoals of this project can be summarized as\n\n* Enable write command line tools or scrips easily to process text data.\n* The output stream API conform to the `TextOutputStream` protocol.\n* Runtime performance comparable to file I/O in Python.\n* Minimal dependency. No dependency on Foundation.\n* Easy to integrate into Xcode projects.\n\nNon-goals\n\n* Building more generalized abstraction layer\n* Memory-mapped file I/O support.\n* Windows support.\n\n## Sample Usage\n\n### Reading data from files\n\n```Swift\nimport FileStream\n\nlet filename = \"/path/to/file\"\nguard var input = InputFileStream(filename) else {\n  print(\"Cannot open\", filename)\n  return\n}\ndefer { input.close() }\n// Read blocks of data (not line)\nwhile let data = input.read() {\n  // process data\n}\n```\n\nYou can read data until EOF:\n\n```Swift\nguard var input = InputFileStream(filename) else {\n  print(\"Cannot open\", filename)\n  return\n}\ndefer { input.close() }\nlet data = input.readAll()\n// process data\n```\n\n### Writing textual data into files\n\n```Swift\nimport FileStream\n\nlet filename = \"/path/to/file\"\nguard var output = OutputFileStream(filename) else {\n  print(\"Cannot open\", filename)\n  return\n}\ndefer { output.close() }\n\n// Print to the opened output stream\nprint(\"hello, world!\", to: \u0026output)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetsuok%2Fswift-filestream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetsuok%2Fswift-filestream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetsuok%2Fswift-filestream/lists"}