fsdir

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 5 Imported by: 26

Documentation

Overview

Package fsdir provides an abstract interface to a directory on disk.

Package fsdir provides an abstract interface to a directory on disk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathEq added in v0.3.8

func PathEq(a, b []string) bool

Compare two paths and return if they're equal

Types

type T

type T string

T is the type of a fsdir.

func New

func New(dir string) (T, error)

New creates a new fsdir.

func (T) Chmod

func (t T) Chmod(mode os.FileMode, ps ...string) error

Chmod changes the permissions of the file or directory under a given path.

func (T) Del

func (t T) Del(ps ...string) error

Del deletes the file or directory under a given path.

func (T) Get

func (t T) Get(x interface{}, ps ...string) error

Get reads the file under the path ps and unmarshals its JSON contents into x.

func (T) Path

func (t T) Path(ps ...string) string

func (T) Rename added in v0.3.7

func (t T) Rename(oldPS, newPS []string) (err error)

Rename moves file from old to new path.

func (T) Set

func (t T) Set(x interface{}, ps ...string) error

Set marshals the x value into JSON and writes it to the the path ps.

func (T) SetIndented added in v0.3.7

func (t T) SetIndented(x interface{}, ps ...string) error

SetIndented marshals the x value into indented JSON and writes it to the the path ps.

Jump to

Keyboard shortcuts

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