xattr: github.com/AlekSi/xattr Index | Files

package xattr

import "github.com/AlekSi/xattr"

Package xattr provides a simple interface to user extended attributes on Linux and OSX. Support for xattrs is filesystem dependant, so not a given even if you are running one of those operating systems.

On Linux you have to edit /etc/fstab to include "user_xattr". Also, Linux extended attributes have a manditory prefix of "user.". This is prepended transparently for Get/Set/Remove and hidden in List.

Index

Package Files

syscall_linux.go xattr.go xattr_linux.go

func Get Uses

func Get(path, attr string) ([]byte, error)

Retrieves extended attribute data associated with path.

func IsNotExist Uses

func IsNotExist(err error) bool

Returns whether the error is known to report that a extended attribute does not exist.

func List Uses

func List(path string) ([]string, error)

Retrieves a list of names of extended attributes associated with path.

func Remove Uses

func Remove(path, attr string) error

Removes the extended attribute.

func Set Uses

func Set(path, attr string, data []byte) error

Associates data as an extended attribute of path.

type XAttrError Uses

type XAttrError struct {
    Op   string
    Path string
    Attr string
    Err  error
}

XAttrError records an error and the operation, file path and attribute that caused it.

func (*XAttrError) Error Uses

func (e *XAttrError) Error() string

Package xattr imports 3 packages (graph). Updated 2017-03-09. Refresh now. Tools for package owners.