buffer

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeBlob = reflect.TypeOf((*blob)(nil))
)
View Source
var TypeFile = reflect.TypeOf((*file)(nil))

Functions

func GetBuffer

func GetBuffer(rt *sobek.Runtime, value sobek.Value) ([]byte, bool)

GetBuffer returns the underlying byte buffer from a ArrayBuffer, TypedArray, DataView, Buffer.

func IsBuffer

func IsBuffer(rt *sobek.Runtime, value sobek.Value) bool

IsBuffer returns true if the value is a IsBuffer.

func NewBlob

func NewBlob(rt *sobek.Runtime, data Reader, size int64, type_ string) sobek.Value

NewBlob returns a new Blob object.

func NewFile

func NewFile(rt *sobek.Runtime, r Reader, size int64, type_, name string, lastModified int64) sobek.Value

NewFile creates a new File object

func ReadAll

func ReadAll(r io.ReaderAt) ([]byte, error)

ReadAll reads all data from io.ReaderAt.

Types

type Blob

type Blob struct{}

Blob interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data. https://developer.mozilla.org/en-US/docs/Web/API/Blob

func (*Blob) Instantiate

func (b *Blob) Instantiate(rt *sobek.Runtime) (sobek.Value, error)

type Buffer

type Buffer struct{}

Buffer used to represent a fixed-length sequence of bytes. https://nodejs.org/api/buffer.html#buffer

func (*Buffer) Instantiate

func (b *Buffer) Instantiate(rt *sobek.Runtime) (sobek.Value, error)

type File

type File struct{}

File object is a specific kind of Blob, and can be used in any context that a Blob can. https://developer.mozilla.org/en-US/docs/Web/API/File

func (*File) Instantiate

func (f *File) Instantiate(rt *sobek.Runtime) (sobek.Value, error)

type Reader

type Reader interface {
	io.Reader
	io.ReaderAt
	io.Seeker
}

func GetReader

func GetReader(value sobek.Value) (Reader, string, bool)

GetReader extracts the underlying Reader and type from a Blob or File. false if value is not a Blob or File.

Jump to

Keyboard shortcuts

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