Giter Club home page Giter Club logo

packet's Introduction

Build Status Platforms Documentation

Packet

A collection of utilities for working with Data and AsyncSequence.

Lots of stuff here is Foundation-specific. But, the idea is to compliment async-algorithms, not overlap.

Integration

dependencies: [
    .package(url: "https://github.com/mattmassicotte/Packet", branch: "main")
]

Usage

FileHandle support:

let fileHandle = FileHandle(...)

for await data in fileHandle.chunks {
    // use Data value here
}

URLSession support. This offers a considerable performance benefit.

let stream = URLSession.shared.chunks(for: url)
for try await data in stream {
    // use Data value here
}

Sometimes, to make things work with an existing API, you need to un-chunk a sequence. AsyncByteSequence converts a sequence of Data into a sequence of UInt8. This is inherently less-efficient, but can be a lot less work than changing the consumer.

let bytes = AsyncByteSequence(dataSequence)

for try await byte in bytes {
    // one byte at a time
}

Contributing and Collaboration

I'd love to hear from you! Get in touch via mastodon, an issue, or a pull request.

I prefer collaboration, and would love to find ways to work together if you have a similar project.

I prefer indentation with tabs for improved accessibility. But, I'd rather you use the system you want and make a PR than hesitate because of whitespace.

By participating in this project you agree to abide by the Contributor Code of Conduct.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.