streamquote

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2023 License: BSD-3-Clause Imports: 3 Imported by: 14

README

streamquote Build Status GoDoc

This package provides a streaming version of strconv.Quote.

It allows you to quote the data in an io.Reader and write it out to an io.Writer without having to store the entire input and the entire output in memory.

Its primary use case is go.rice and similar tools, which need to convert lots of files, some of them quite large, to go strings.

converter := streamquote.New()
converter.Convert(inputfile, outfile)

Unlike strconv.Quote, it does not add quotes around the output.

Documentation

Overview

Package streamquote implements a streaming version of strconv.Quote.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter interface {
	// Convert converts the data in "in", writing it to "out".
	// It uses Go escape sequences (\t, \n, \xFF, \u0100) for control characters
	// and non-printable characters as defined by strconv.IsPrint.
	// It is not safe for concurrent use.
	Convert(in io.Reader, out io.Writer) (int, error)
}

Converter converts data by escaping control characters and non-printable characters using Go escape sequences.

func New

func New() Converter

New returns a new Converter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL