package fd

import "github.com/cyphar/filepath-securejoin/pathrs-lite/internal/fd"

Package fd provides a drop-in interface-based replacement of *os.File that allows for things like noop-Close wrappers to be used.

Index

Types

type Fd

type Fd interface {
	io.Closer
	Name() string
	Fd() uintptr
}

Fd is an interface that mirrors most of the API of *os.File, allowing you to create wrappers that can be used in place of *os.File.

func NopCloser

func NopCloser(f Fd) Fd

NopCloser returns an *os.File-like object where the Close method is now a no-op.

Note that for *os.File and similar objects, the Go garbage collector will still call Close on the underlying file unless you use runtime.SetFinalizer to disable this behaviour. This is up to the caller to do (if necessary).

Source Files

fd.go

Version
v0.6.1 (latest)
Published
Nov 19, 2025
Platform
darwin/amd64
Imports
2 packages
Last checked
9 minutes ago

Tools for package owners.