ops

package
v0.0.0-...-1982c3d Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env

func Env(ctx *quickjs.Context, data []quickjs.Value) quickjs.Value

Env elsa handler

func Fetch

func Fetch(ctx *quickjs.Context, url quickjs.Value) quickjs.Value

func Serve

func Serve(ctx *quickjs.Context, callback func(request quickjs.Value) (response string),
	id quickjs.Value, host quickjs.Value)

Serve listens for HTTP requests to host and calls callback sequentially on every request.

Types

type FileInfo

type FileInfo struct {
	Name    string
	Size    int64
	Mode    os.FileMode
	ModTime time.Time
	IsDir   bool
}

type FsDriver

type FsDriver struct {
	Perms *options.Perms
	Fs    afero.Fs
}

func (*FsDriver) Cwd

func (fs *FsDriver) Cwd(ctx *quickjs.Context) quickjs.Value

func (*FsDriver) DirExists

func (fs *FsDriver) DirExists(ctx *quickjs.Context, path quickjs.Value) quickjs.Value

func (*FsDriver) Exists

func (fs *FsDriver) Exists(ctx *quickjs.Context, path quickjs.Value) quickjs.Value

func (*FsDriver) Mkdir

func (fs *FsDriver) Mkdir(ctx *quickjs.Context, path quickjs.Value) quickjs.Value

func (*FsDriver) ReadFile

func (fs *FsDriver) ReadFile(ctx *quickjs.Context, path quickjs.Value) quickjs.Value

func (*FsDriver) Remove

func (fs *FsDriver) Remove(ctx *quickjs.Context, path quickjs.Value) quickjs.Value

func (*FsDriver) Stat

func (fs *FsDriver) Stat(ctx *quickjs.Context, path quickjs.Value) quickjs.Value

func (*FsDriver) Walk

func (fs *FsDriver) Walk(ctx *quickjs.Context, pathDir quickjs.Value) quickjs.Value

func (*FsDriver) WriteFile

func (fs *FsDriver) WriteFile(ctx *quickjs.Context, path quickjs.Value, content quickjs.Value) quickjs.Value

type Request

type Request struct {
	Method           string
	URL              *fasthttp.URI
	Path             string
	Header           fasthttp.RequestHeader
	ContentLength    int64
	TransferEncoding []string
	Host             string
	Form             url.Values
	PostForm         *fasthttp.Args
	RemoteAddr       net.Addr
	RequestURI       string
	Referer          string
	UserAgent        string
	LocalAddr        net.Addr
	RemoteIP         net.IP
	LocalIP          net.IP
	PostArgs         *fasthttp.Args
	QueryArgs        *fasthttp.Args
}

type Response

type Response struct {
	// Status code
	Status int32
	// Body of the response
	Body string
}

Response response returned by callback from js

Jump to

Keyboard shortcuts

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