file

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package file provides functions for dealing with files.

Index

Constants

This section is empty.

Variables

View Source
var Scope = wdte.S().Map(map[wdte.ID]wdte.Func{
	"open":   wdte.GoFunc(Open),
	"create": wdte.GoFunc(Create),
	"append": wdte.GoFunc(Append),
})

Scope is a scope containing the functions in this package.

Functions

func Append

func Append(frame wdte.Frame, args ...wdte.Func) wdte.Func

Append is a WDTE function with the following signature:

append path

Opens the file at path for appending, creating it if it doesn't already exist, and returns it.

func Create

func Create(frame wdte.Frame, args ...wdte.Func) wdte.Func

Create is a WDTE function with the following signature:

create path

Creates the file at path, truncating it if it already exists, and returns it.

func Open

func Open(frame wdte.Frame, args ...wdte.Func) wdte.Func

Open is a WDTE function with the following signature:

open path

Opens the file at path and returns it.

Types

type File

type File struct {
	*os.File
	// contains filtered or unexported fields
}

File wraps an os.File, allowing it to be used as a WDTE function. While it contains unexproted fields, it is safe for a client to simply wrap an *os.File in it manually.

A file is considered a "File" by reflection, as well as a "Reader" if it is opened for reading and a "Writer" if it is opened for writing. If the file was created manually, it will be considered both a reader and a writer.

func (File) Call

func (f File) Call(frame wdte.Frame, args ...wdte.Func) wdte.Func

func (File) Reflect added in v0.4.2

func (f File) Reflect(name string) bool

func (File) String added in v0.2.3

func (f File) String() string

Jump to

Keyboard shortcuts

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