file

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: LGPL-2.1 Imports: 7 Imported by: 1

Documentation

Overview

Commands for reading and writing files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commands

type Commands struct {
	utils.Module
	// contains filtered or unexported fields
}

func New

func New(scopeable utils.Scopeable) *Commands

func (*Commands) Close added in v1.0.0

func (self *Commands) Close(file *os.File) error

func (*Commands) Create added in v1.0.0

func (self *Commands) Create(filename string) (*os.File, error)

func (*Commands) Open added in v1.0.0

func (self *Commands) Open(filename string) (*os.File, error)

func (*Commands) Read

func (self *Commands) Read(source interface{}) (string, error)

func (*Commands) Temp

func (self *Commands) Temp(args *TempArgs) (*os.File, error)

func (*Commands) Write

func (self *Commands) Write(destination interface{}, args *WriteArgs) error

type TempArgs

type TempArgs struct {
	// A string to prefix temporary filenames with
	Prefix string `json:"prefix" default:"friendscript-"`
}

type WriteArgs

type WriteArgs struct {
	// The data to write as a stream.
	Data io.Reader `json:"data"`

	// The data to write as a discrete value.
	Value interface{} `json:"value"`

	// Whether to attempt to close the destination (if possible) after reading/writing.
	Autoclose bool `json:"autoclose" default:"true"`
}

Jump to

Keyboard shortcuts

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