file

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

File IO commands

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commands

type Commands struct {
	*file.Commands
	// contains filtered or unexported fields
}

func New

func New(browser *browser.Browser, env utils.Scopeable) *Commands

func (*Commands) Write

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

Write a value or a stream of data to a file at the given path. The destination path can be a local filesystem path, a URI that uses a custom scheme registered outside of the application, or the string "temporary", which will write to a temporary file whose path will be returned in the response.

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"`
}

type WriteResponse

type WriteResponse struct {
	// The filesystem path that the data was written to.
	Path string `json:"path,omitempty"`

	// The size of the data (in bytes).
	Size int64 `json:"size,omitempty"`
}

Jump to

Keyboard shortcuts

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