go-linereader: A small library for streaming lines from an io.Reader.

Overview

go-linereader

A small library for streaming lines from an io.Reader.

Example

// Create a default LineReader, delimited by newlines
lr := linereader.New( source /* io.Reader */ )
for {

    // Read a single line from the reader
    line, err := lr.Line()
    if err != nil {
        panic(err)
    }

    // A nil line means we've reached the end of the stream
    if line == nil {
        break
    }

    // Print the found line
    fmt.Println("LINE: ", string(line))

}

Using custom delimiters

lr := linereader.WithDelimiter(
    source, /* io.Reader */
    []byte("zz"),
)

The above example uses zz as a delimiter. Splitting fizzbuzz123 by that delimiter would result in [fi, bu, 123].

You might also like...
Small utility to cleanup entries with unexpected/erroneous ttl in redis

Small utility to cleanup entries with unexpected/erroneous ttl in redis

An API that provides a small but well-thought service converting Euro to US Dollar and vice-versa

Currency Converter ###Problem An API that provides a small but well-thought service converting Euro to US Dollar and vice-versa. That API should only

Small tool for splitting files found in a path into multiple groups

Small tool for splitting files found in a path into multiple groups. Usefull for parallelisation of whatever can be paralleled with multiple files.

Govalid is a data validation library that can validate most data types supported by golang

Govalid is a data validation library that can validate most data types supported by golang. Custom validators can be used where the supplied ones are not enough.

Maintain a lower-bitrate copy of a music library in sync with the main copy.

msync Maintain a lower-bitrate copy of your music library, in sync with the main copy.

Golang library to act on structure fields at runtime. Similar to Python getattr(), setattr(), hasattr() APIs.

go-attr Golang library to act on structure fields at runtime. Similar to Python getattr(), setattr(), hasattr() APIs. This package provides user frien

Go library for HTTP content type negotiation

Content-Type support library for Go This library can be used to parse the value Content-Type header (if one is present) and select an acceptable media

A tool and library for using structural regular expressions.

Structural Regular Expressions sregx is a package and tool for using structural regular expressions as described by Rob Pike (link).

A super simple Lodash like utility library with essential functions that empowers the development in Go
A super simple Lodash like utility library with essential functions that empowers the development in Go

A simple Utility library for Go Go does not provide many essential built in functions when it comes to the data structure such as slice and map. This

Releases(v1.0.1)
Owner
Conner Douglass
Founder, CTO, systems engineer
Conner Douglass
Golang io.Reader and io.Writer but with limits

LimitIO io.Reader and io.Writer with limit.

LI Zhennan 72 Dec 14, 2022
csv reader/writer.

IO csv reader sample version 0.0.1-SNAPSHOT Goals: main: read huge file, hex substring, write to new file. cmd/v2 version can read and write use ony o

Cranes Team 2 Nov 4, 2021
Wrap byte read options with uniform interface for io.Reader and byte slice

nibbler Nibble chunks from Reader streams and slice in a common way Overview This is a golang module that provides an interface for treating a Reader

null 0 Dec 23, 2021
MNA - stands for mobile number assignment - a small zero external dependency golang library that is used to identify mobile number assignment in tanzania

MNA - stands for mobile number assignment - a small zero external dependency golang library that is used to identify mobile number assignment in tanzania

TECHCRAFT TECHNOLOGIES LIMITED 8 Nov 29, 2021
A small & fast dependency-free library for parsing micro expressions.

MicroExpr A small & fast dependency-free library for parsing micro expressions. This library was originally built for use in templating languages (e.g

Daniel G. Taylor 10 Nov 25, 2022
Go Small Library

Go Small Library (gosl) Copyright Gon Y. Yi 2021 Goal General No import of any library whatsoever including standard libr

Gon 0 Jan 12, 2022
A collection of small Go utilities to make life easier.

The simplego package provides a collection of Go utilities for common tasks.

John Wang 41 Jan 4, 2023
Small utility to allow simpler, quicker testing of parsing files in crowdsec

cs_parser_test Small utility to allow simpler, quicker testing of parsing files in crowdsec Usage $ sudo cs_parser_test -t syslog /var/log/mail.log N

david reid 3 Jul 13, 2021
A small utility to extract your Telegram contacts as VCF file.

Telegram to VCF A small utility to extract your Telegram contacts as VCF file. Usage At first build this application or use the precompiled binaries o

Hirbod Behnam 4 Nov 16, 2022
This is a small utility that finds unused exported Go symbols (functions, methods ...) in Go

This is a small utility that finds unused exported Go symbols (functions, methods ...) in Go. For all other similar use cases

Bjørn Erik Pedersen 22 Nov 8, 2022