{"id":19910258,"url":"https://github.com/juri/swift-netstring","last_synced_at":"2025-07-10T17:33:18.268Z","repository":{"id":143625418,"uuid":"91898787","full_name":"juri/swift-netstring","owner":"juri","description":"Netstrings in Swift","archived":false,"fork":false,"pushed_at":"2017-06-18T15:11:37.000Z","size":1386,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T08:30:56.631Z","etag":null,"topics":["netstrings","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juri.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":"2017-05-20T15:38:00.000Z","updated_at":"2017-05-20T15:56:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e9d311f-1fc8-401f-8b5f-95840aba17bb","html_url":"https://github.com/juri/swift-netstring","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/juri/swift-netstring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juri%2Fswift-netstring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juri%2Fswift-netstring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juri%2Fswift-netstring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juri%2Fswift-netstring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juri","download_url":"https://codeload.github.com/juri/swift-netstring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juri%2Fswift-netstring/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264619624,"owners_count":23638484,"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":["netstrings","swift"],"created_at":"2024-11-12T21:18:12.587Z","updated_at":"2025-07-10T17:33:18.156Z","avatar_url":"https://github.com/juri.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Netstrings in Swift\n\n[![Build Status](https://travis-ci.org/juri/swift-netstring.svg?branch=master)](https://travis-ci.org/juri/swift-netstring)\n[![Documentation Status](https://juri.github.io/swift-netstring/badge.svg)](https://juri.github.io/swift-netstring/)\n\nImplements [netstrings](https://cr.yp.to/proto/netstrings.txt) in Swift 3.1.\n\n## Usage\n\nTo create a netstring:\n\n```swift\n\nlet ns = Netstring(payload: [0x4f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x4d, 0x65, 0x6e, 0x61, 0x63, 0x65])\nlet bytes = ns.export()\n```\n\nTo parse:\n\n```swift\nlet data: [UInt8] = [0x34, 0x3a, 0x73, 0x77, 0x61, 0x67, 0x2c]\nif case let .success(ns) = Netstring.parse(array: data) {\n    let payload = ns.payload\n}\n```\n\nThe array-based constructor delegates to a closure-based one. It takes in a closure of type `(Int) -\u003e [UInt8]` that `Netstring` asks to provide bytes as necessary. You can use it to read input from a stream (socket, pipe, file etc.)\n\nSee also [the reference documentation](https://juri.github.io/swift-netstring/), `Usage.playground` and `NetstringTests`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuri%2Fswift-netstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuri%2Fswift-netstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuri%2Fswift-netstring/lists"}