bytestring: Fast, compact, strict and lazy byte strings with a list interface

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

An efficient compact, immutable byte string type (both strict and lazy) suitable for binary or 8-bit character data.

The ByteString type represents sequences of bytes or 8-bit characters. It is suitable for high performance use, both in terms of large data quantities, or high speed requirements. The ByteString functions follow the same style as Haskell's ordinary lists, so it is easy to convert code from using String to ByteString.

Two ByteString variants are provided:

  • Strict ByteStrings keep the string as a single large array. This makes them convenient for passing data between C and Haskell.

  • Lazy ByteStrings use a lazy list of strict chunks which makes it suitable for I/O streaming tasks.

The Char8 modules provide a character-based view of the same underlying ByteString types. This makes it convenient to handle mixed binary and 8-bit character content (which is common in many file formats and network protocols).

The Builder module provides an efficient way to build up ByteStrings in an ad-hoc way by repeated concatenation. This is ideal for fast serialisation or pretty printing.

There is also a ShortByteString type which has a lower memory overhead and can be converted to or from a ByteString. It is suitable for keeping many short strings in memory.

ByteStrings are not designed for Unicode. For Unicode strings you should use the Text type from the text package.

These modules are intended to be imported qualified, to avoid name clashes with Prelude functions, e.g.

import qualified Data.ByteString as BS

[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.9, 0.9.0.1, 0.9.0.2, 0.9.0.3, 0.9.0.4, 0.9.1.0, 0.9.1.1, 0.9.1.2, 0.9.1.3, 0.9.1.4, 0.9.1.5, 0.9.1.6, 0.9.1.7, 0.9.1.8, 0.9.1.9, 0.9.1.10, 0.9.2.0, 0.9.2.1, 0.10.0.0, 0.10.0.1, 0.10.0.2, 0.10.2.0, 0.10.4.0, 0.10.4.1, 0.10.6.0, 0.10.8.0, 0.10.8.1, 0.10.8.2, 0.10.9.0, 0.10.10.0, 0.10.10.1, 0.10.12.0, 0.10.12.1, 0.11.0.0, 0.11.1.0, 0.11.2.0, 0.11.3.0, 0.11.3.1, 0.11.4.0, 0.11.5.0, 0.11.5.1, 0.11.5.2, 0.11.5.3, 0.12.0.0, 0.12.0.1, 0.12.0.2, 0.12.1.0
Change log Changelog.md
Dependencies base (>=4.9 && <4.20), deepseq (<1.6), ghc-prim (<0.12), template-haskell (<2.22) [details]
Tested with ghc ==9.4.1, ghc ==9.2.4, ghc ==9.0.2, ghc ==8.10.7, ghc ==8.8.4, ghc ==8.6.5, ghc ==8.4.4, ghc ==8.2.2, ghc ==8.0.2
License BSD-3-Clause
Copyright Copyright (c) Don Stewart 2005-2009, (c) Duncan Coutts 2006-2015, (c) David Roundy 2003-2005, (c) Jasper Van der Jeugt 2010, (c) Simon Meier 2010-2013.
Author Don Stewart, Duncan Coutts
Maintainer Haskell Bytestring Team <andrew.lelechenko@gmail.com>, Core Libraries Committee
Revised Revision 1 made by clyring at 2024-02-21T04:17:28Z
Category Data
Home page https://github.com/haskell/bytestring
Bug tracker https://github.com/haskell/bytestring/issues
Source repo head: git clone https://github.com/haskell/bytestring
Uploaded by clyring at 2023-01-12T20:00:33Z
Distributions Arch:0.11.4.0, Fedora:0.11.4.0
Reverse Dependencies 6081 direct, 8813 indirect [details]
Downloads 117930 total (701 in the last 30 days)
Rating 2.75 (votes: 20) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-01-12 [all 1 reports]

Readme for bytestring-0.11.4.0

[back to package description]

ByteString: Fast, Packed Strings of Bytes

Build Status Hackage Stackage LTS Stackage Nightly

This library provides the Data.ByteString module -- strict and lazy byte arrays manipulable as strings -- providing very time/space-efficient string and IO operations.

For very large data requirements, or constraints on heap size, Data.ByteString.Lazy is provided, a lazy list of bytestring chunks. Efficient processing of multi-gigabyte data can be achieved this way.

The library also provides Data.ByteString.Builder for efficient construction of ByteString values from smaller pieces during binary serialization.

Requirements:

  • Cabal 1.10 or greater
  • GHC 8.0 or greater

Authors

ByteString was derived from the GHC PackedString library, originally written by Bryan O'Sullivan, and then by Simon Marlow. It was adapted and greatly extended for darcs by David Roundy and others. Don Stewart and Duncan Coutts cleaned up and further extended the implementation and added the .Lazy code. Simon Meier contributed the Builder feature.