file

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package file provides helpers for common file system interactions such as creating, reading and removing files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseFile

func CloseFile(closer io.Closer)

CloseFile closes the provided io.Closer and logs an error if closing fails.

func ReadFile

func ReadFile(filePath string) (*bytes.Reader, error)

ReadFile reads a file from disk and returns a bytes.Reader containing the file contents.

func ReadLines

func ReadLines(filename string) ([]string, error)

ReadLines reads a text file line by line and returns a slice of strings. The file is opened for reading and closed automatically. An error is returned if the file cannot be opened or scanned.

func RemoveAll

func RemoveAll(tempDir string)

RemoveAll recursively deletes the directory at tempDir. Any error encountered is logged but not returned.

func RemoveFile

func RemoveFile(filePath string)

RemoveFile deletes the file located at filePath. Errors are logged and not returned to the caller.

func SaveFile

func SaveFile(outputDir string, fileName string, fileContent []byte) error

SaveFile writes fileContent to a file named fileName.html inside outputDir. The directory is created if it does not already exist.

Types

This section is empty.

Jump to

Keyboard shortcuts

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