totext

package module
v0.0.0-...-4563aed Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

go-totext

Text utility.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deflate

func Deflate(text string) (string, error)

Deflate is function for deflate strings to Base64 strings.

func Dirs

func Dirs(dataRoot string) ([]string, error)

Dirs is function to get dir list from inputted path.

func Files

func Files(dataRoot string) ([]string, error)

Files is function to get file list from inputted path.

func Inflate

func Inflate(base64String string) (string, error)

Inflate is function for inflate base64 strings to plain strings.

func MakeDir

func MakeDir(path string) error

MakeDir is function to make dir if not exists.

func ReadLine

func ReadLine(reader *bufio.Reader, lineBuffer []byte) (string, error)

ReadLine is function to iterate lines on bufio.Reader. lineBuffer should be byte slice to buffer data, it can make as make([]byte, 0, 1024*1024) or more simply []byte. 3rd option number of 'make()' will be effect to read speed, It's depends on average length of each lines, I think. In many cases it's enough to 1024*1024.

usage: var rd = bufio.NewReaderSize(fp, bufferSize)

for {
    line, err := readLine(rd, make([]byte, 0, 1024*1024))
    if err != nil {
        if err == io.EOF {
            break
        }
        panic(err)
    }
    lines = append(lines, line)
}

func ReadLineNormal

func ReadLineNormal(rd *bufio.Reader, limitBytes int) (string, bool, error)

ReadLineNormal is old function to iterate lines on bufio.Reader. *** this is old function. *** The example value for limitBytes is 1000000.

func WriteLines

func WriteLines(filename string, lines []string, linesep string, modeStr string, permission os.FileMode) error

WriteLines is function to write string array.

Types

This section is empty.

Jump to

Keyboard shortcuts

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