chunker

package
v0.0.146 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupChunks

func CleanupChunks(result *ChunkResult) error

CleanupChunks removes the temporary directory and all chunk files

Types

type ChunkConfig

type ChunkConfig struct {
	By        string // How to split the file: "lines", "bytes", or "tokens"
	Size      int    // Chunk size (e.g., 10000 lines)
	Overlap   int    // Lines/bytes to overlap between chunks for context
	MaxChunks int    // Limit total chunks to prevent overload
}

ChunkConfig represents the configuration for chunking a large file

type ChunkResult

type ChunkResult struct {
	ChunkPaths  []string // Paths to the temporary chunk files
	TempDir     string   // Path to the temporary directory containing the chunks
	TotalChunks int      // Total number of chunks created
}

ChunkResult contains information about the chunking operation

func SplitFile

func SplitFile(filePath string, config ChunkConfig) (*ChunkResult, error)

SplitFile splits a file into chunks based on the provided configuration It returns the paths to the temporary chunk files and a cleanup function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL