osfs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Overview

Package osfs implements lesiw.io/fs.FS using the os package.

This package is primarily intended for examples and testing. It provides a simple filesystem implementation backed by the operating system's native filesystem, supporting all optional interfaces defined in lesiw.io/fs.

Context Handling

The lesiw.io/fs package uses context.Context throughout its API to support cancelation and timeouts for remote filesystem operations (e.g., cloud storage, network filesystems). However, since osfs uses the local os package, context cancelation does not apply and all context parameters are ignored.

This is acceptable for an example implementation, but production filesystem implementations that perform I/O over a network should respect context cancelation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() fs.FS

New returns a filesystem that operates on the OS filesystem. All paths are resolved relative to the process's current working directory, or relative to a directory specified via fs.WithWorkDir in the context.

func NewTemp

func NewTemp() fs.FS

NewTemp creates a temporary directory and returns a filesystem with its virtual working directory set to the temp directory.

Call fs.Close() on the returned filesystem to remove the temporary directory.

NewTemp never returns an error. If OS temp directory creation fails, it falls back to a local randomized path that will be created on first use.

Types

This section is empty.

Jump to

Keyboard shortcuts

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