- Notifications
You must be signed in to change notification settings - Fork0
yalue/chunked_file
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Thechunked_file
package implements theio.ReadSeeker
andio.WriteSeeker
interface, backed by multiple underlying files on disk.
As you write to aChunkedWriter
instance, multiple files are automaticallycreated on disk, each being up to a user-specified chunk size. Users can alsocreate aChunkedReader
using a list of filenames, which will transparentlyprovide data from each underlying file as if they are a single contiguous file.
Online documentation on pkg.go.dev.
Example:
import ("github.com/yalue/chunked_file""path/filepath")funcmain() {// As we write to this, automatically create 4KB files named// my_data.part.0, my_data.part.1, etc.chunkedWriter,_:=chunked_file.NewChunkedWriter(4096,"my_data")// ... Use the chunkedWriter as you would any normal io.WriteSeeker. Note// that seeking ahead may zero-fill any prior unwritten data.// Closing the chunkedWriter will close all underlying files.chunkedWriter.Close()// We can use filepath.Glob to obtain a list of all of the .part files// created by the chunkedWriter, and read them using a ChunkedReader.filePaths,_:=filepath.Glob("my_data.part.*")chunkedReader,_:=chunked_file.NewChunkedReader(filePaths...)// ... Use the chunkedReader as you would any normal io.ReadSeeker.// As with the writer, closing the reader closes all underlying files.chunkedReader.Close()}
About
A go (golang) project for seekable read or write access backed by multiple underlying files in storage.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.