{"id":16341521,"url":"https://github.com/psibi/streamly-bytestring","last_synced_at":"2025-07-25T00:40:27.352Z","repository":{"id":29098004,"uuid":"189770011","full_name":"psibi/streamly-bytestring","owner":"psibi","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-20T20:15:01.000Z","size":95,"stargazers_count":9,"open_issues_count":3,"forks_count":8,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-11T23:59:38.885Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psibi.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","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-06-01T19:23:42.000Z","updated_at":"2024-07-20T20:06:10.000Z","dependencies_parsed_at":"2024-01-29T20:29:03.259Z","dependency_job_id":"259ede4f-cc22-497d-bd47-3779c46bb211","html_url":"https://github.com/psibi/streamly-bytestring","commit_stats":{"total_commits":75,"total_committers":8,"mean_commits":9.375,"dds":0.2666666666666667,"last_synced_commit":"0e7ff4955729551937520d6eca5f739ca6c1e777"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psibi%2Fstreamly-bytestring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psibi%2Fstreamly-bytestring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psibi%2Fstreamly-bytestring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psibi%2Fstreamly-bytestring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psibi","download_url":"https://codeload.github.com/psibi/streamly-bytestring/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221665164,"owners_count":16860186,"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-10-10T23:59:38.738Z","updated_at":"2024-10-27T10:49:07.467Z","avatar_url":"https://github.com/psibi.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# streamly-bytestring\n\nLibrary for streamly and bytestring interoperation.\n\nIf you are writing code from scratch, please use `Streamly.Data.Array` which is\na generalization of `ByteString` and better integrated with streamly.\n\nThis library is to enable interoperation of streamly with existing code that\nuses `ByteString`.\n\nThe package provides APIs to interconvert between strict `Bytestring` and\nstreamly `Array Word8` and between lazy `Bytestring` and stream of `Array\nWord8`.\n\nThe interconversion in the case of strict `Bytestring` and streamly `Array\nWord8` has no overhead for GHC allocated memory. For foreign allocator allocated\nmemory there is a copy involved.\n\n## Usage\n\nThis is a dumb program that counts the number of bytes in a file.\n\n```haskell\nimport qualified Streamly.Data.Stream as S\nimport qualified Streamly.Data.Fold as FL\n\nimport qualified Data.ByteString as BS\nimport qualified Data.ByteString.Lazy as BSL\n\nimport qualified Streamly.External.ByteString as Strict\nimport qualified Streamly.External.ByteString.Lazy as Lazy\n\nimport System.IO (FilePath)\n\nstrictByteStringSize :: BS.ByteString -\u003e IO Int\nstrictByteStringSize bs = S.fold FL.length $ S.unfold Strict.reader bs\n\nlazyByteStringSize :: BSL.ByteString -\u003e IO Int\nlazyByteStringSize bsl =\n    S.fold (FL.foldl' (+) 0)\n        $ S.mapM strictByteStringSize\n        $ fmap Strict.fromArray\n        $ Lazy.toChunks bsl\n\nfileSize :: FilePath -\u003e IO Int\nfileSize path = do\n    bsl \u003c- BSL.readFile path\n    lazyByteStringSize bsl\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsibi%2Fstreamly-bytestring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsibi%2Fstreamly-bytestring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsibi%2Fstreamly-bytestring/lists"}