https://github.com/andrewstuart/yenc
Implementations of yenc reader and writer in Go.
https://github.com/andrewstuart/yenc
binary go golang reader usenet writer yenc
Last synced: 9 months ago
JSON representation
Implementations of yenc reader and writer in Go.
- Host: GitHub
- URL: https://github.com/andrewstuart/yenc
- Owner: andrewstuart
- License: mit
- Created: 2015-04-26T01:30:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-01-24T03:56:26.000Z (almost 2 years ago)
- Last Synced: 2025-03-24T16:46:18.084Z (10 months ago)
- Topics: binary, go, golang, reader, usenet, writer, yenc
- Language: Go
- Size: 67.4 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yenc
--
import "github.com/andrewstuart/yenc"
Package yenc implements readers writers for the YENC encoding format.
## Usage
```go
var (
ErrBadCRC = fmt.Errorf("CRC check error")
ErrWrongSize = fmt.Errorf("size check error")
)
```
Error constants
#### type Reader
```go
type Reader struct {
Length int
CRC hash.Hash32
Headers, Footer *YENCHeader
}
```
Reader implements the io.Reader methods for an underlying YENC document/stream.
It additionally exposes some of the metadata that may be useful for consumers.
#### func NewReader
```go
func NewReader(r io.Reader) *Reader
```
NewReader returns a reader from an input reader.
#### func (*Reader) Read
```go
func (d *Reader) Read(p []byte) (bytesRead int, err error)
```
#### type Writer
```go
type Writer struct {
CRC hash.Hash32
Length, Line int
Name string
Header, Footer *YENCHeader
}
```
#### func NewWriter
```go
func NewWriter(w io.Writer) *Writer
```
#### func (*Writer) Close
```go
func (w *Writer) Close() error
```
#### func (*Writer) Write
```go
func (w *Writer) Write(p []byte) (written int, err error)
```
#### type YENCHeader
```go
type YENCHeader map[string]string
```
#### func ReadYENCHeader
```go
func ReadYENCHeader(br *bufio.Reader) (*YENCHeader, error)
```
#### func (*YENCHeader) Add
```go
func (y *YENCHeader) Add(k, v string)
```
#### func (*YENCHeader) Get
```go
func (y *YENCHeader) Get(k string) string
```
#### func (*YENCHeader) String
```go
func (y *YENCHeader) String() string
```