yenc decoder package for Go (golang)

yenc.go

A single/multipart yenc decoder. Usually used for binary files stored on Usenet servers.

Installation

The easy way:

go get github.com/chrisfarms/yenc

Docs

Decode accepts an io.Reader (of yenc encoded data - complete with headers) and returns a *Part.

func Decode(input io.Reader) (*Part, error)

The Part struct contains all the decoded data.

type Part struct {

    // part num
    Number int

    // size from part trailer
    Size int
    
    // file boundarys
    Begin, End int
    
    // filename from yenc header
    Name string

    // the decoded data
    Body []byte
    
    // ..contains filtered or unexported fields..
}

Example

package main
import (
	"github.com/chrisfarms/yenc"
	"os"
)
func main(){
	f,err := os.Open("some_file.yenc")
	if err != nil {
	    panic("could not open file")
	}
	part,err := yenc.Decode(f)
	if err != nil {
	    panic("decoding: " + err.Error())
	}
	fmt.Println("Filename", part.Name)
	fmt.Println("Body Bytes", part.Body)
}
Owner
Similar Resources

Simple base64 coder/decoder written in Golang

base64-coder simple base64 coder/decoder written in Golang 🖱️ Releases usage example Encode: ./b64 encode from.txt to.dat Decode: ./b64 encode to.dat

Jan 4, 2022

Querydecoder - Optional query parameter decoder for Golang

Optional query parameter decoder for Golang Example import ( "github.com/ritwic

Nov 8, 2022

GAAD (Go Advanced Audio Decoder)

GAAD (Go Advanced Audio Decoder) Package currently provides AAC parsing capabilities. This package performs a full parse of AAC-LC and HE-AACv1 bitstr

Oct 24, 2022

A "native" ogg vorbis decoder for Go (uses inline stb_vorbis)

vorbis This Go package provides a "native" ogg vorbis decoder, but still requires cgo, as it uses inline code from stb_vorbis. Someday, it won't. The

Oct 24, 2022

Fast, secure and efficient secure cookie encoder/decoder

Encode and Decode secure cookies This package provides functions to encode and decode secure cookie values. A secure cookie has its value ciphered and

Dec 9, 2022

BPG decoder for Go (Zero Dependencies).

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa BPG for Go BPG is defined at: http://bellard.o

Sep 7, 2020

Rich TIFF/BigTIFF/GeoTIFF decoder/encoder for Go (Pure Go/Zero Dependencies)

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa TIFF for Go Features: Support BigTiff Support

Nov 16, 2022

WebP decoder and encoder for Go (Zero Dependencies).

WebP decoder and encoder for Go (Zero Dependencies).

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa webp ██╗ ██╗███████╗██████╗ ██████╗ ██║

Dec 28, 2022

PHP session encoder/decoder written in Go

php_session_decoder PHP session encoder/decoder written in Go Installation Install: The recommended way to install is using gonuts.io: nut get yvasiya

Sep 27, 2022

Fast JSON encoder/decoder compatible with encoding/json for Go

Fast JSON encoder/decoder compatible with encoding/json for Go

Fast JSON encoder/decoder compatible with encoding/json for Go

Jan 6, 2023

An efficient JSON decoder

pkg/json An alternative JSON decoder for Go. Features pkg/json aims to be a drop in replacement for encoding/json. It features: json.Scanner which, wh

Dec 5, 2022

concurrent caching proxy and decoder library for collections of PMTiles

go-pmtiles A caching proxy for the serverless PMTiles archive format. Resolves several of the limitations of PMTiles by running a minimalistic, single

Jan 2, 2023

Go decoder for EU Digital COVID Certificate (EUDCC) QR code data

Go Corona QR Code Decoder This repository contains a decoder for EU Digital COVID Certificate (EUDCC) QR code data, written in Go. If you got vaccinat

Nov 30, 2022

Pure Go Brotli encoder and decoder

This package is a brotli compressor and decompressor implemented in Go. It was translated from the reference implementation (https://github.com/google

Dec 28, 2022

A COVID-19 Certificate Decoder based on @stapelberg's coronaqr library / CLI

corona-decoder This is a super simple CLI application that uses @stapelberg's coronaqr library / CLI to provide quickly some information about a COVID

Mar 1, 2022

Pure Go encoder/decoder of the QOI image format

QOI - The “Quite OK Image” format for fast, lossless image compression package and small utilities in native Go, quite OK implementation See qoi.h for

Nov 12, 2022

Go encoder and decoder for the NetBPM/PNM image formats. Compatible with Go's image packages.

gpnm This package implements an encoder and decoder for PNM image formats. It can be used with Go's image library. It covers all formats as defined by

Nov 26, 2021

BMP image decoder and encoder

bmp Package bmp implements a BMP image decoder and encoder. The BMP specification is at http://www.digicamsoft.com/bmp/bmp.html. Supported BMP feature

Nov 25, 2022

goi - The “Quite OK Image” format encoder / decoder for Go.

goi - The “Quite OK Image” format encoder / decoder for Go.

goi - The “Quite OK Image” format encoder / decoder for Go. QOI - The “Quite OK Image” - is losslessly image format that offering speedup both compres

Mar 3, 2022
Comments
  • Skip multipart validation unless all parts are present

    Skip multipart validation unless all parts are present

    This fixes Decode() when used on the final part of a multipart yenc by skipping crc32 validation. Only pcrc32 validation is performed, since only the last part is available.

    The existing behavior is preserved in the case where all parts are fed to Decode in a single call. This PR only affects calls to Decode where only one part of the multipart yenc is supplied.

  • Get size from header?

    Get size from header?

    I have this header:

    =ybegin part=1 total=21 line=128 size=15728640 name=blablabla
    =ypart begin=1 end=768000
    
    	part, err := yenc.Decode(inputFile)
    	if err != nil {
    		panic("decoding: " + err.Error())
    	}
    	fmt.Println(part.Name)
    	fmt.Println(part.Size)
    

    part.Size only prints the size of the article which is 768000. How can we grab the size parameter from the header? size=15728640

Related tags
Nfc-sun-decoder - A Decoder for NXP 424 DNA SUN (Secure Unique) messages

NFC SUN Decoder A Decoder for NXP 424 DNA SUN (Secure Unique) messages This library makes decoding 424 DNA SUN messages easier. While the 424 DNA chip

Aug 24, 2022
COBS implementation in Go (Decoder) and C (Encoder & Decoder) with tests.

COBS Table of Contents About The project COBS Specification Getting Started 3.1. Prerequisites 3.2. Installation 3.3. Roadmap Contributing License Con

May 22, 2022
Package polyline implements a Google Maps Encoding Polyline encoder and decoder.

go-polyline Package polyline implements a Google Maps Encoding Polyline encoder and decoder. Encoding example func ExampleEncodeCoords() { coords :=

Dec 1, 2022
asciigrid is a Go package that implements decoder and encoder for the Esri ASCII grid format, also known as ARC/INFO ASCII GRID.

asciigrid asciigrid is a Go package that implements decoder and encoder for the Esri ASCII grid format, also known as ARC/INFO ASCII GRID. Install go

Jul 3, 2022
Pbm - Package ppm implements a Portable Bit Map (PBM) image decoder and encoder written in Go

Package pbm import "github.com/slashformotion/pbm" Package pbm implements a Portable Bit Map (PBM) image decoder and encoder. The supported image col

Jan 5, 2022
Golang binary decoder for mapping data into the structure

binstruct Golang binary decoder to structure Install go get -u github.com/ghostiam/binstruct Examples ZIP decoder PNG decoder Use For struct From file

Dec 17, 2022
Fixed width file parser (encoder/decoder) in GO (golang)

Fixed width file parser (encoder/decoder) for GO (golang) This library is using to parse fixed-width table data like: Name Address

Sep 27, 2022
Golang implementation of the covid certificate QRCode decoder

Golang implementation of the covid certificates. At the moment it only includes DCC signed data decoding but I've planned to add a lot more of features related to certificates processing.

Sep 22, 2021
Golang JSON decoder supporting case-sensitive, number-preserving, and strict decoding use cases

Golang JSON decoder supporting case-sensitive, number-preserving, and strict decoding use cases

Dec 9, 2022
Mpq Decoder Golang TODO: MAke Description

MPQ MPQ archive codec Report Bug · Request Feature About This package provides a MPQ archive codec, for compressing and decompressing MoPaQ archives.

Nov 2, 2021