{"id":20290451,"url":"https://github.com/ksss/mruby-io-copy_stream","last_synced_at":"2025-09-01T03:36:49.956Z","repository":{"id":145733005,"uuid":"93982270","full_name":"ksss/mruby-io-copy_stream","owner":"ksss","description":"IO.copy_stream method for mruby","archived":false,"fork":false,"pushed_at":"2018-05-12T03:43:17.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-04T04:42:53.399Z","etag":null,"topics":["mruby"],"latest_commit_sha":null,"homepage":null,"language":"C","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/ksss.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-11T04:49:01.000Z","updated_at":"2018-10-02T10:34:21.000Z","dependencies_parsed_at":"2023-03-28T00:19:53.086Z","dependency_job_id":null,"html_url":"https://github.com/ksss/mruby-io-copy_stream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ksss/mruby-io-copy_stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Fmruby-io-copy_stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Fmruby-io-copy_stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Fmruby-io-copy_stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Fmruby-io-copy_stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksss","download_url":"https://codeload.github.com/ksss/mruby-io-copy_stream/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksss%2Fmruby-io-copy_stream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273069870,"owners_count":25040138,"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-09-01T02:00:09.058Z","response_time":120,"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":["mruby"],"created_at":"2024-11-14T15:07:38.666Z","updated_at":"2025-09-01T03:36:49.911Z","avatar_url":"https://github.com/ksss.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"mruby-io-copy_stream\n=====\n\nThe implementation of `IO.copy_stream` method for mruby.\n\n# Feature\n\n- Support `pread(2)`\n- Support `sendfile(2)` if linux\n- It doesn't have dependency to IO library.\n\n# Special spec of this library\n\n- Use fd for system call if respond to `fileno` method.\n- Use `read` and `write` method if doesn't have fd.\n- Use `seek` method if doesn't have fd for src_offset option.\n\n# Performance\n\n```rb\n# bigfile is 440MB text file\n\nt = Time.now\nIO.copy_stream(\"bigfile\", \"bigfile-copy\")\nputs Time.now - t\n\nt = Time.now\nFile.open(\"bigfile\") do |src|\n  IO.copy_stream(src, \"bigfile-copy\")\nend\nputs Time.now - t\n\nt = Time.now\nFile.open(\"bigfile-copy\", \"w\") do |dst|\n  IO.copy_stream(\"bigfile\", dst)\nend\nputs Time.now - t\n\nt = Time.now\nFile.open(\"bigfile\") do |src|\n  File.open(\"bigfile-copy\", \"w\") do |dst|\n    IO.copy_stream(src, dst)\n  end\nend\nputs Time.now - t\n```\n\nCRuby\n\n```\n$ ruby t.rb\n0.407673\n0.400015\n0.395681\n0.401305\n```\n\nmruby use this library with [mruby-io](https://github.com/iij/mruby-io)\n\n```\n$ mruby t.rb\n0.452422\n0.419008\n0.403466\n0.412026\n```\n\n# How to development with docker\n\n```\n$ docker-compose -f docker/docker-compose.yml build\n$ docker-compose -f docker/docker-compose.yml run test\n```\n\n```\n$ make test\n```\n\n# See also\n\nhttps://ruby-doc.org/core-2.4.1/IO.html#method-c-copy_stream\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksss%2Fmruby-io-copy_stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksss%2Fmruby-io-copy_stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksss%2Fmruby-io-copy_stream/lists"}