All Projects â†’ scodec â†’ Scodec Stream

scodec / Scodec Stream

Licence: bsd-3-clause
Binding between scodec and FS2

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Scodec Stream

Osagai
🀄ïļA tiny library for creating WebComponents in a Functional way
Stars: ✭ 42 (-26.32%)
Mutual labels:  functional-programming
Qt Promise
Chainable promises for Qt
Stars: ✭ 48 (-15.79%)
Mutual labels:  functional-programming
Modules
Modules in R
Stars: ✭ 54 (-5.26%)
Mutual labels:  functional-programming
Karate
Webscraper
Stars: ✭ 45 (-21.05%)
Mutual labels:  functional-programming
Smallfunction
Stack allocated and type-erased functors 🐜
Stars: ✭ 47 (-17.54%)
Mutual labels:  functional-programming
Rambda
Faster and smaller alternative to Ramda
Stars: ✭ 1,066 (+1770.18%)
Mutual labels:  functional-programming
With Or Without Fp
į”Ļå‡―æ•°åžįž–įĻ‹é‡æž„äŧĢį å§ïž
Stars: ✭ 41 (-28.07%)
Mutual labels:  functional-programming
Haskell Book Readers Exercises
Exercises from the readers of the Haskell Book
Stars: ✭ 56 (-1.75%)
Mutual labels:  functional-programming
Functionalrx
FunctionalRx is a collection of constructs to simplify a functional programming approach to Java and [STABLE]
Stars: ✭ 47 (-17.54%)
Mutual labels:  functional-programming
Seamless Immutable Cursor
Compact Cursor Library built on top of the excellent seamless-immutable
Stars: ✭ 54 (-5.26%)
Mutual labels:  functional-programming
Mostly Adequate Guide Ru
Mostly adequate guide to FP (in javascript, translated to russian)
Stars: ✭ 1,030 (+1707.02%)
Mutual labels:  functional-programming
Funland
Type classes for interoperability of common algebraic structures in JavaScript, TypeScript and Flow
Stars: ✭ 46 (-19.3%)
Mutual labels:  functional-programming
Bullseye
A functional language frontend for the Dart VM.
Stars: ✭ 53 (-7.02%)
Mutual labels:  functional-programming
Ios Oss
Kickstarter for iOS. Bring new ideas to life, anywhere.
Stars: ✭ 7,840 (+13654.39%)
Mutual labels:  functional-programming
Jhc Components
JHC Haskell compiler split into reusable components
Stars: ✭ 55 (-3.51%)
Mutual labels:  functional-programming
Graphql Lodash
🛠 Data manipulation for GraphQL queries with lodash syntax
Stars: ✭ 1,003 (+1659.65%)
Mutual labels:  functional-programming
Bkmrkd
Bkmrkd is a self-hosted, lightweight bookmarking service run on node.js and rethinkdb
Stars: ✭ 52 (-8.77%)
Mutual labels:  functional-programming
Noexception
Java library for handling exceptions in concise, unified, and architecturally clean way.
Stars: ✭ 56 (-1.75%)
Mutual labels:  functional-programming
Affect
Algebraic effects for Ruby
Stars: ✭ 56 (-1.75%)
Mutual labels:  functional-programming
Tsoption
Correct, easy to use Option type for TypeScript. ðŸĶ„
Stars: ✭ 53 (-7.02%)
Mutual labels:  functional-programming

scodec-stream

Scodec-stream is a library for streaming binary encoding and decoding. It is built atop scodec and fs2. Here's a brief example of its use:

import scodec.codecs._
import scodec.stream._
import scodec.bits._
import cats.effect.{Blocker, IO}
import fs2.Stream

val frames: StreamDecoder[ByteVector] = StreamDecoder.many(int32)
 .flatMap { numBytes => StreamDecoder.once(bytes(numBytes)) }

val filePath = java.nio.file.Paths.get("path/to/file")

val s: Stream[IO, ByteVector] =
  Stream.resource(Blocker[IO]).flatMap { blocker =>
    fs2.io.file.readAll[IO](filePath, blocker, 4096).through(frames.toPipeByte)
  }

When consumed, s will incrementally read chunks from "largefile.bin", then decode a stream of frames, where each frame is expected to begin with a number of bytes specified as a 32-bit signed int (the int32 codec), followed by a frame payload of that many bytes. Nothing happens until the s stream is consumed, and s will ensure the file is closed in the event of an error or normal termination of the consumer.

See the MPEG PCAP decoding example for a more sophisticated use case.

Links:

Administrative

This project is licensed under a 3-clause BSD license.

People are expected to follow the Typelevel Code of Conduct when discussing scodec on the Github page, Gitter channel, mailing list, or other venues.

Concerns or issues can be sent to Michael Pilquist ([email protected]) or to Typelevel.

Getting Binaries

See the releases page on the website.

Code of Conduct

See the Code of Conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].