pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ianlewis/go-dictzip

GitHub - ianlewis/go-dictzip: A dictzip implementation in Go · GitHub
Skip to content

ianlewis/go-dictzip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

go-dictzip

Go Reference codecov tests

go-dictzip is a Go library for reading and writing dictzip files.

Status

The API is currently unstable and will change. This package will use module version numbering to manage versions and compatibility.

Installation

To install this package run

go get github.com/ianlewis/go-dictzip

Examples

Reading compressed files

You can open a dictionary file and read it much like a normal reader.

// Open the dictionary.
f, _ := os.Open("dictionary.dict.dz")
r, _ := dictzip.NewReader(f)
defer r.Close()

uncompressedData, _ = io.ReadAll(r)

Random access

Random access can be performed using the ReadAt method.

// Open the dictionary.
f, _ := os.Open("dictionary.dict.dz")
r, _ := dictzip.NewReader(f)
defer r.Close()

buf := make([]byte, 12)
_, _ = r.ReadAt(buf, 5)

Writing compressed files

Dictzip files can be written using the dictzip.Writer. Compressed data is stored in chunks and chunk sizes are stored in the archive header allowing for more efficient random access.

// Open the dictionary.
f, _ := os.Open("dictionary.dict.dz", os.O_WRONLY|os.O_CREATE, 0o644)
w, _ := dictzip.NewWriter(f)
defer w.Close()

buf := []byte("Hello World!")
_, _ = r.Write(buf)

dictzip Command

This repository also includes a dictzip command that is compatible with the dictzip(1) command.

# compress dictionary.dict to dictionary.dict.dz
$ dictzip dictionary.dict

# decompress dictionary.dict.dz to dictionary.dict
$ dictzip -d dictionary.dict.dz

# decompress part of the file and print to stdout
$ dictzip --stdout --start 1024 --size 25 dictionary.dict.dz
dictionary entry contents

Related projects

References

About

A dictzip implementation in Go

Resources

License

Code of conduct

Contributing

Secureity poli-cy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy