fslink

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 6 Imported by: 3

README

Implementation of the proposal to add fs.ReadLinkFS: https://github.com/golang/go/issues/49580

Documentation

Overview

Package fslink is an implementation of the proposal to add a fs.ReadLinkFS interface: https://github.com/golang/go/issues/49580

This package is intended to be deprecated once #49580 is merged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lstat added in v0.1.3

func Lstat(fsys fs.FS, name string) (fs.FileInfo, error)

Lstat is like fs.Stat but if the name is a symbolic link, it returns information about the link instead of the target file.

At this time, the implementation emulates the behavior by scanning the parent directory looking for an entry with a matching name since this is the only way to get file information of a symbolic link using a fs.FS file system.

func ReadLink(fsys fs.FS, name string) (string, error)

ReadLink reads the value of the symbolic link at the given name in fsys.

func Sub

func Sub(fsys fs.FS, dir string) (fs.FS, error)

Sub is like fs.Sub but it returns a type that implements ReadLinkFS.

Types

type ReadLinkFS

type ReadLinkFS interface {
	fs.FS
	ReadLink(string) (string, error)
}

ReadLinkFS is an extension of the fs.FS interface implemented by file systems which support symbolic links.

Jump to

Keyboard shortcuts

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