1
0
Fork 0
No description
Find a file
Daniel Baumann 8cffdf7dd0
Releasing fastforward version 3.0.1-2~ffwd13+u1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-07-19 12:57:52 +02:00
debian Releasing fastforward version 3.0.1-2~ffwd13+u1. 2025-07-19 12:57:52 +02:00
.travis.yml Adding upstream version 3.0.1. 2025-07-19 12:57:00 +02:00
go.mod Adding upstream version 3.0.1. 2025-07-19 12:57:00 +02:00
go.sum Adding upstream version 3.0.1. 2025-07-19 12:57:00 +02:00
LICENSE.txt Adding upstream version 3.0.1. 2025-07-19 12:57:00 +02:00
nio.go Adding upstream version 3.0.1. 2025-07-19 12:57:00 +02:00
nio_test.go Adding upstream version 3.0.1. 2025-07-19 12:57:00 +02:00
README.md Adding upstream version 3.0.1. 2025-07-19 12:57:00 +02:00
sync.go Adding upstream version 3.0.1. 2025-07-19 12:57:00 +02:00

nio

GoDoc Release Software License Build Status Coverage Status Go Report Card

Usage

The Buffer interface:

type Buffer interface {
	Len() int64
	Cap() int64
	io.ReadWriter
}

nio's Copy method concurrently copies from an io.Reader to a supplied nio.Buffer, then from the nio.Buffer to an io.Writer. This way, blocking writes don't slow the io.Reader.

import (
  "github.com/djherbis/buffer"
  "github.com/djherbis/nio"
)

buf := buffer.New(32*1024) // 32KB In memory Buffer
nio.Copy(w, r, buf) // Reads and Writes concurrently, buffering using buf.

nio's Pipe method is a buffered version of io.Pipe The writer return once its data has been written to the Buffer. The reader returns with data off the Buffer.

import (
  "gopkg.in/djherbis/buffer.v1"
  "gopkg.in/djherbis/nio.v2"
)

buf := buffer.New(32*1024) // 32KB In memory Buffer
r, w := nio.Pipe(buf)

Installation

go get gopkg.in/djherbis/nio.v2

For some pre-built buffers grab:

go get gopkg.in/djherbis/buffer.v1

Mentions

GopherCon 2017: Peter Bourgon - Evolutionary Optimization with Go