{"id":22282855,"url":"https://github.com/maxfreck/freck-streams","last_synced_at":"2026-03-19T22:18:14.693Z","repository":{"id":189589027,"uuid":"83451081","full_name":"maxfreck/freck-streams","owner":"maxfreck","description":"  Easy-to-use I/O streams library","archived":false,"fork":false,"pushed_at":"2018-03-12T15:58:40.000Z","size":40,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T17:38:29.215Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"D","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/maxfreck.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}},"created_at":"2017-02-28T15:53:01.000Z","updated_at":"2022-08-15T17:07:24.000Z","dependencies_parsed_at":"2023-08-20T22:12:14.779Z","dependency_job_id":null,"html_url":"https://github.com/maxfreck/freck-streams","commit_stats":null,"previous_names":["maxfreck/freck-streams"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxfreck%2Ffreck-streams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxfreck%2Ffreck-streams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxfreck%2Ffreck-streams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxfreck%2Ffreck-streams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxfreck","download_url":"https://codeload.github.com/maxfreck/freck-streams/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245534641,"owners_count":20631288,"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":[],"created_at":"2024-12-03T16:36:50.156Z","updated_at":"2026-01-06T10:05:04.042Z","avatar_url":"https://github.com/maxfreck.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Travis](https://travis-ci.org/maxfreck/freck-streams.svg?branch=master)](https://travis-ci.org/maxfreck/freck-streams)\n[![Dub version](https://img.shields.io/dub/v/freck-streams.svg)](https://code.dlang.org/packages/freck-streams)\n\n# Freck Streams\n\nThis packae contains primitives for I/O using streams and stream decorators.\n\n## MemoryStream\n\nSimple in-memory stream.\n\n```D\nimport std.stdio;\nimport freck.streams.streaminterface;\nimport freck.streams.memorystream;\n\nauto stream = MemoryStream.fromBytes(cast(ubyte[])\"Hello\", [\"Roses\": \"Are red\"]);\n\nstream.seek(0, Seek.end);\nstream.write(cast(ubyte[])\" World!\");\n\nwriteln(\"Roses: \", stream.getMetadata(\"Roses\"));\nwriteln(\"Stream content: \", cast(string)stream.getContents);\n```\n\n## FileStream\n\nSimple file stream built on top of `std.stdio.File`.\n\n```D\nimport std.stdio;\nimport freck.streams.streaminterface;\nimport freck.streams.filestream;\n\nauto stream = new FileStream(\"stream.txt\", \"w+b\", [\"Roses\": \"Are red\"]);\n\nstream.write(cast(ubyte[])\"Hello World!\");\nstream.seek(0, Seek.set);\n\nwriteln(\"Roses: \", stream.getMetadata(\"Roses\"));\n//.read(1024) Reads 1024 bytes or the whole stream to the end, if it is smaller.\nwriteln(\"Stream content: \", cast(string)stream.read(1024));\n```\n\n## AppendStream\n\nReads from multiple streams, one after the other.\n\n```D\nimport std.stdio;\nimport freck.streams.streaminterface;\nimport freck.streams.memorystream;\nimport freck.streams.appendstream;\n\nauto stream1 = MemoryStream.fromBytes(cast(ubyte[])\"Hello \");\nauto stream2 = MemoryStream.fromBytes(cast(ubyte[])\"World\");\nauto stream3 = MemoryStream.fromBytes(cast(ubyte[])\"!\");\n\nauto allTogether = new AppendStream([\n  stream1,\n  stream2,\n  stream3,\n]);\n\nwriteln(\"Stream content: \", cast(string)allTogether.getContents);\n```\n\n## Endianness\n\nEach stream has an endianness attribute with default value `Endian.platform`. This attribute affects on reading/writing scalar types from/to the stream.\n\n```D\nimport std.stdio;\nimport freck.streams.streaminterface;\nimport freck.streams.memorystream;\nimport freck.streams.util: readScalar;\n\nauto stream = MemoryStream.fromBytes(cast(ubyte[])[1, 2, 3, 4]);\n\nstream.setEndian(Endian.little);\nstream.seek(0);\nauto ret1 = stream.readScalar!uint;\nwritefln(\"Returns: %.8x\", ret1); //04030201\n\nstream.setEndian(Endian.big);\nstream.seek(0);\nauto ret2 = stream.readScalar!uint;\nwritefln(\"Returns: %.8x\", ret2); //01020304\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxfreck%2Ffreck-streams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxfreck%2Ffreck-streams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxfreck%2Ffreck-streams/lists"}