Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A go (golang) project for seekable read or write access backed by multiple underlying files in storage.

NotificationsYou must be signed in to change notification settings

yalue/chunked_file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thechunked_file package implements theio.ReadSeeker andio.WriteSeekerinterface, backed by multiple underlying files on disk.

Usage

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp