Documentation
¶
Overview ¶
Package fileio owns temporary command files and atomic JSON replacement.
Index ¶
- func CheckJSONPaths(paths ...string) error
- func Create(dir string) (*os.File, error)
- func Link(src, dir string) (string, error)
- func ReadJSON(path string, value any) error
- func Remove(path string) error
- func WriteJSON(path string, value any, indent bool) (err error)
- type CleanupError
- type Output
- type RewriteItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckJSONPaths ¶
CheckJSONPaths refuses paths that encoding/json would silently change to different names.
func ReadJSON ¶
ReadJSON loads exactly one nonnull document, refusing bytes JSON would silently replace.
Types ¶
type CleanupError ¶
CleanupError identifies an owned path that could not be removed and must remain recorded.
func (*CleanupError) Error ¶
func (e *CleanupError) Error() string
func (*CleanupError) Unwrap ¶
func (e *CleanupError) Unwrap() error
type Output ¶
Output owns a destination descriptor and, when staged, its exclusive temporary path. Owners hand it off sequentially; callers must wait for all users before discarding it. A direct device has a File and Path but no Temporary, so cleanup never removes it.
type RewriteItem ¶
RewriteItem passes an already-open output and observed source metadata to the copy engine. The command persists Temporary before submission and discards Output only after Wait.
func (*RewriteItem) Source ¶
func (i *RewriteItem) Source() string
Source returns the original file's path.
func (*RewriteItem) Targets ¶
func (i *RewriteItem) Targets() []string
Targets reports the final path; Output owns the separate temporary used during copying.