fileutil

package
v0.3.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package fileutil provides shared filesystem helpers for Compozy components.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPath = errors.New("fileutil: invalid path")

ErrInvalidPath reports a path that cannot be represented safely by the filesystem boundary.

Functions

func AtomicRemoveFile

func AtomicRemoveFile(path string) error

AtomicRemoveFile removes a file and syncs its parent directory.

func AtomicWrite

func AtomicWrite(path string, content []byte) error

AtomicWrite writes content with the default Compozy file permissions via temp-file-and-rename.

func AtomicWriteFile

func AtomicWriteFile(path string, content []byte, perm os.FileMode) error

AtomicWriteFile writes content to path via a temp file plus atomic replacement. It always syncs the temp file before replacement. Parent-directory metadata durability remains best-effort on platforms without directory fsync support.

func SyncDir

func SyncDir(path string) error

SyncDir fsyncs directory metadata when the current platform supports it.

func TarGzipDirectory

func TarGzipDirectory(root string, excludeTopLevel map[string]struct{}) ([]byte, error)

TarGzipDirectory returns a deterministic gzip-compressed tar stream. Names in excludeTopLevel omit matching entries directly below root.

Types

This section is empty.

Jump to

Keyboard shortcuts

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