About

Get Started

Docs

stream

import "github.com/gosolid/solid/pkg/runtime/stream"

Index

func Pipeline

func Pipeline(ctx context.Context, args ...*isolates.Value) *isolates.Value

type BufferEncoding

type BufferEncoding string
var (
    BufferEncodingUTF8   BufferEncoding = "utf8"
    BufferEncodingHex    BufferEncoding = "hex"
    BufferEncodingBase64 BufferEncoding = "base64"
)

type Closer

type Closer struct {
    io.Closer
}

func NewCloser

func NewCloser(in isolates.FunctionArgs) (*Closer, error)

func (*Closer) Destroy

func (c *Closer) Destroy(in isolates.FunctionArgs, this Stream, err *isolates.Value, callback *isolates.Value) error

func (*Closer) V8FuncDestroy

func (c *Closer) V8FuncDestroy(in isolates.FunctionArgs) (*isolates.Value, error)

type Duplex

type Duplex interface {
    Readable
    Writable
}

type DuplexBase

type DuplexBase struct {
    *StreamBase
    *WritableBase
    *ReadableBase
}

func NewDuplex

func NewDuplex(in isolates.FunctionArgs) (*DuplexBase, error)

type Pipe

type Pipe interface {
    Destination() *isolates.Value
    Remove(ctx context.Context) error
    OnData() *isolates.Value
    OnError() *isolates.Value
    OnEnd() *isolates.Value
}

type PipeBase

type PipeBase struct {
    // contains filtered or unexported fields
}

func (*PipeBase) Destination

func (p *PipeBase) Destination() *isolates.Value

func (*PipeBase) OnData

func (p *PipeBase) OnData() *isolates.Value

func (*PipeBase) OnEnd

func (p *PipeBase) OnEnd() *isolates.Value

func (*PipeBase) OnError

func (p *PipeBase) OnError() *isolates.Value

func (*PipeBase) Remove

func (p *PipeBase) Remove(ctx context.Context) error

func (*PipeBase) Source

func (p *PipeBase) Source() *isolates.Value

func (*PipeBase) V8FuncRemove

func (p *PipeBase) V8FuncRemove(in isolates.FunctionArgs) (*isolates.Value, error)

func (*PipeBase) V8GetDestination

func (p *PipeBase) V8GetDestination(in isolates.GetterArgs) (*isolates.Value, error)

func (*PipeBase) V8GetOnData

func (p *PipeBase) V8GetOnData(in isolates.GetterArgs) (*isolates.Value, error)

func (*PipeBase) V8GetOnEnd

func (p *PipeBase) V8GetOnEnd(in isolates.GetterArgs) (*isolates.Value, error)

func (*PipeBase) V8GetOnError

func (p *PipeBase) V8GetOnError(in isolates.GetterArgs) (*isolates.Value, error)

func (*PipeBase) V8GetSource

func (p *PipeBase) V8GetSource(in isolates.GetterArgs) (*isolates.Value, error)

type ReadCloser

type ReadCloser struct {
    *Closer
    *Reader
}

func NewReadCloser

func NewReadCloser(in isolates.FunctionArgs) (*ReadCloser, error)

type ReadWriteCloser

type ReadWriteCloser struct {
    *Closer
    *Reader
    *Writer
}

func NewReadWriteCloser

func NewReadWriteCloser(in isolates.FunctionArgs) (*ReadWriteCloser, error)

func (*ReadWriteCloser) Final

func (c *ReadWriteCloser) Final(in isolates.FunctionArgs, this Writable, callback *isolates.Value) error

func (*ReadWriteCloser) V8FuncFinal

func (c *ReadWriteCloser) V8FuncFinal(in isolates.FunctionArgs) (*isolates.Value, error)

type Readable

type Readable interface {
    Stream
    io.Reader

    IsPaused() bool
    Pause(context.Context)
    Pipe(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)
    ReadV8(ctx context.Context, size int) error
    Readable() bool
    ReadableAborted() bool
    ReadableDidRead() bool
    ReadableEncoding() *BufferEncoding
    ReadableEnded() bool
    ReadableFlowing() bool
    ReadableHighWaterMark() int
    ReadableLength() int
    ReadableObjectMode() bool
    Resume(context.Context)
    SetEncoding(BufferEncoding) (*isolates.Value, error)
    Unpipe(context.Context, *isolates.Value) (*isolates.Value, error)
    Unshift(context.Context, *isolates.Value, *BufferEncoding) error
    Wrap(context.Context, *isolates.Value) (*isolates.Value, error)
    Compose(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)
    Iterator(context.Context, *isolates.Value) (*isolates.Value, error)
    Map(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)
    Filter(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)
    ForEach(context.Context, *isolates.Value, *isolates.Value) error
    ToArray(context.Context, *isolates.Value) (*isolates.Value, error)
    Some(context.Context, *isolates.Value, *isolates.Value) (bool, error)
    Find(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)
    Every(context.Context, *isolates.Value, *isolates.Value) (bool, error)
    FlatMap(context.Context, *isolates.Value, *isolates.Value) (Readable, error)
    Drop(context.Context, int, *isolates.Value) (Readable, error)
    Take(context.Context, int, *isolates.Value) (Readable, error)
    AsIndexedPairs(context.Context, *isolates.Value) (Readable, error)
    Reduce(context.Context, *isolates.Value, *isolates.Value, *isolates.Value) (*isolates.Value, error)
    Push(ctx context.Context, chunk *isolates.Value, encoding *BufferEncoding) (bool, error)
}

type ReadableBase

type ReadableBase struct {
    *StreamBase
    // contains filtered or unexported fields
}

func NewReadable

func NewReadable(in isolates.FunctionArgs) (*ReadableBase, error)

func NewReadableWithStream

func NewReadableWithStream(in isolates.FunctionArgs, StreamBase *StreamBase) (*ReadableBase, error)

func (*ReadableBase) AsIndexedPairs

func (r *ReadableBase) AsIndexedPairs(context.Context, *isolates.Value) (Readable, error)

func (*ReadableBase) Compose

func (r *ReadableBase) Compose(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) Drop

func (r *ReadableBase) Drop(context.Context, int, *isolates.Value) (Readable, error)

func (*ReadableBase) Every

func (r *ReadableBase) Every(context.Context, *isolates.Value, *isolates.Value) (bool, error)

func (*ReadableBase) Filter

func (r *ReadableBase) Filter(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) Find

func (r *ReadableBase) Find(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) FlatMap

func (r *ReadableBase) FlatMap(context.Context, *isolates.Value, *isolates.Value) (Readable, error)

func (*ReadableBase) ForEach

func (r *ReadableBase) ForEach(context.Context, *isolates.Value, *isolates.Value) error

func (*ReadableBase) IsPaused

func (r *ReadableBase) IsPaused() bool

func (*ReadableBase) Iterator

func (r *ReadableBase) Iterator(context.Context, *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) Map

func (r *ReadableBase) Map(context.Context, *isolates.Value, *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) Pause

func (r *ReadableBase) Pause(context.Context)

func (*ReadableBase) Pipe

func (r *ReadableBase) Pipe(ctx context.Context, destination *isolates.Value, options *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) Push

func (r *ReadableBase) Push(ctx context.Context, chunk *isolates.Value, encoding *BufferEncoding) (bool, error)

func (*ReadableBase) Read

func (s *ReadableBase) Read(b []byte) (int, error)

func (*ReadableBase) ReadV8

func (r *ReadableBase) ReadV8(ctx context.Context, size int) error

func (*ReadableBase) Readable

func (r *ReadableBase) Readable() bool

func (*ReadableBase) ReadableAborted

func (r *ReadableBase) ReadableAborted() bool

func (*ReadableBase) ReadableDidRead

func (r *ReadableBase) ReadableDidRead() bool

func (*ReadableBase) ReadableEncoding

func (r *ReadableBase) ReadableEncoding() *BufferEncoding

func (*ReadableBase) ReadableEnded

func (r *ReadableBase) ReadableEnded() bool

func (*ReadableBase) ReadableFlowing

func (r *ReadableBase) ReadableFlowing() bool

func (*ReadableBase) ReadableHighWaterMark

func (r *ReadableBase) ReadableHighWaterMark() int

func (*ReadableBase) ReadableLength

func (r *ReadableBase) ReadableLength() int

func (*ReadableBase) ReadableObjectMode

func (r *ReadableBase) ReadableObjectMode() bool

func (*ReadableBase) Reduce

func (r *ReadableBase) Reduce(context.Context, *isolates.Value, *isolates.Value, *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) Resume

func (r *ReadableBase) Resume(ctx context.Context)

func (*ReadableBase) SetEncoding

func (r *ReadableBase) SetEncoding(BufferEncoding) (*isolates.Value, error)

func (*ReadableBase) SetReadableState

func (s *ReadableBase) SetReadableState(state ReadableStreamState) bool

func (*ReadableBase) SetReadableStateConditional

func (s *ReadableBase) SetReadableStateConditional(fromState ReadableStreamState, toState ReadableStreamState) bool

func (*ReadableBase) Some

func (r *ReadableBase) Some(context.Context, *isolates.Value, *isolates.Value) (bool, error)

func (*ReadableBase) Take

func (r *ReadableBase) Take(context.Context, int, *isolates.Value) (Readable, error)

func (*ReadableBase) ToArray

func (r *ReadableBase) ToArray(context.Context, *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) Unpipe

func (r *ReadableBase) Unpipe(ctx context.Context, destination *isolates.Value) (*isolates.Value, error)

func (*ReadableBase) Unshift

func (r *ReadableBase) Unshift(context.Context, *isolates.Value, *BufferEncoding) error

func (*ReadableBase) V8FuncAsIndexedPairs

func (r *ReadableBase) V8FuncAsIndexedPairs(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncCompose

func (r *ReadableBase) V8FuncCompose(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncDrop

func (r *ReadableBase) V8FuncDrop(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncEvery

func (r *ReadableBase) V8FuncEvery(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncFilter

func (r *ReadableBase) V8FuncFilter(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncFind

func (r *ReadableBase) V8FuncFind(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncFlatMap

func (r *ReadableBase) V8FuncFlatMap(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncForEach

func (r *ReadableBase) V8FuncForEach(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncIterator

func (r *ReadableBase) V8FuncIterator(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncMap

func (r *ReadableBase) V8FuncMap(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncPause

func (r *ReadableBase) V8FuncPause(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncPipe

func (r *ReadableBase) V8FuncPipe(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncPush

func (r *ReadableBase) V8FuncPush(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncReadV8

func (r *ReadableBase) V8FuncReadV8(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncReduce

func (r *ReadableBase) V8FuncReduce(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncResume

func (r *ReadableBase) V8FuncResume(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncSetEncoding

func (r *ReadableBase) V8FuncSetEncoding(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncSome

func (r *ReadableBase) V8FuncSome(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncTake

func (r *ReadableBase) V8FuncTake(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncToArray

func (r *ReadableBase) V8FuncToArray(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncUnpipe

func (r *ReadableBase) V8FuncUnpipe(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncUnshift

func (r *ReadableBase) V8FuncUnshift(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8FuncWrap

func (r *ReadableBase) V8FuncWrap(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetIsPaused

func (r *ReadableBase) V8GetIsPaused(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadable

func (r *ReadableBase) V8GetReadable(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadableAborted

func (r *ReadableBase) V8GetReadableAborted(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadableDidRead

func (r *ReadableBase) V8GetReadableDidRead(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadableEncoding

func (r *ReadableBase) V8GetReadableEncoding(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadableEnded

func (r *ReadableBase) V8GetReadableEnded(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadableFlowing

func (r *ReadableBase) V8GetReadableFlowing(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadableHighWaterMark

func (r *ReadableBase) V8GetReadableHighWaterMark(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadableLength

func (r *ReadableBase) V8GetReadableLength(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) V8GetReadableObjectMode

func (r *ReadableBase) V8GetReadableObjectMode(in isolates.GetterArgs) (*isolates.Value, error)

func (*ReadableBase) Wrap

func (r *ReadableBase) Wrap(context.Context, *isolates.Value) (*isolates.Value, error)

type ReadableStreamState

type ReadableStreamState int
const (
    ReadableStreamStatePaused ReadableStreamState = iota
    ReadableStreamStateResumed
)

type Reader

type Reader struct {
    io.Reader
    // contains filtered or unexported fields
}

func NewReader

func NewReader(in isolates.FunctionArgs) (*Reader, error)

func (*Reader) Construct

func (c *Reader) Construct(in isolates.FunctionArgs, this Stream, callback *isolates.Value) error

func (*Reader) Read

func (c *Reader) Read(in isolates.FunctionArgs, this Readable) error

func (*Reader) V8FuncConstruct

func (c *Reader) V8FuncConstruct(in isolates.FunctionArgs) (*isolates.Value, error)

func (*Reader) V8FuncRead

func (c *Reader) V8FuncRead(in isolates.FunctionArgs) (*isolates.Value, error)

type Stream

type Stream interface {
    events.EventEmitter
    io.Closer
    Destroy(context.Context, *isolates.Value) error
    Closed() bool
    Destroyed() bool
    Errored() *isolates.Value
}

type StreamBase

type StreamBase struct {
    *events.EventEmitterBase

    Context *isolates.Context
    This    *isolates.Value
    Options *isolates.Value
    // contains filtered or unexported fields
}

func NewStream

func NewStream(in isolates.FunctionArgs) (*StreamBase, error)

func (*StreamBase) Close

func (s *StreamBase) Close() error

func (*StreamBase) Closed

func (s *StreamBase) Closed() bool

func (*StreamBase) Destroy

func (s *StreamBase) Destroy(ctx context.Context, err *isolates.Value) error

func (*StreamBase) Destroyed

func (s *StreamBase) Destroyed() bool

func (*StreamBase) EmitError

func (s *StreamBase) EmitError(ctx context.Context, err error) error

func (*StreamBase) EmitErrorValue

func (s *StreamBase) EmitErrorValue(ctx context.Context, error *isolates.Value) error

func (*StreamBase) Errored

func (s *StreamBase) Errored() *isolates.Value

func (*StreamBase) OnStateChange

func (s *StreamBase) OnStateChange(callback func(s StreamState) error) func()

func (*StreamBase) SetState

func (s *StreamBase) SetState(state StreamState) bool

func (*StreamBase) SetStateConditional

func (s *StreamBase) SetStateConditional(fromState StreamState, toState StreamState) bool

func (*StreamBase) V8FuncDestroy

func (s *StreamBase) V8FuncDestroy(in isolates.FunctionArgs) (*isolates.Value, error)

func (*StreamBase) V8GetClosed

func (s *StreamBase) V8GetClosed(in isolates.GetterArgs) (*isolates.Value, error)

func (*StreamBase) V8GetDestroyed

func (s *StreamBase) V8GetDestroyed(in isolates.GetterArgs) (*isolates.Value, error)

func (*StreamBase) V8GetErrored

func (s *StreamBase) V8GetErrored(in isolates.GetterArgs) (*isolates.Value, error)

type StreamState

type StreamState int
const (
    StreamStateNew StreamState = iota
    StreamStateReady
    StreamStateErrored
    StreamStateDestroying
    StreamStateDestroyed
    StreamStateClosing
    StreamStateClosed
)

type Transform

type Transform interface {
    Duplex
}

type TransformBase

type TransformBase struct {
    *DuplexBase
}

func NewTransform

func NewTransform(in isolates.FunctionArgs) (*TransformBase, error)

type Writable

type Writable interface {
    Stream
    io.Writer

    Cork(context.Context) error
    End(context.Context, ...any) error
    SetDefaultEncoding(encoding BufferEncoding)
    Uncork(context.Context) error
    Writable() bool
    WritableAborted() bool
    WritableEnded() bool
    WritableCorked() int

    WritableFinished() bool
    WritableHighWaterMark() int
    WritableLength() int
    WritableNeedDrain() bool
    WritableObjectMode() bool
    WritableWrite(context.Context, ...any) error
}

type WritableBase

type WritableBase struct {
    *StreamBase
}

func NewWritable

func NewWritable(in isolates.FunctionArgs) (*WritableBase, error)

func NewWritableWithStream

func NewWritableWithStream(in isolates.FunctionArgs, StreamBase *StreamBase) (*WritableBase, error)

func (*WritableBase) Cork

func (w *WritableBase) Cork(context.Context) error

func (*WritableBase) End

func (w *WritableBase) End(ctx context.Context, args ...any) error

func (*WritableBase) SetDefaultEncoding

func (w *WritableBase) SetDefaultEncoding(encoding BufferEncoding)

func (*WritableBase) Uncork

func (w *WritableBase) Uncork(context.Context) error

func (*WritableBase) V8FuncCork

func (w *WritableBase) V8FuncCork(in isolates.FunctionArgs) (*isolates.Value, error)

func (*WritableBase) V8FuncEnd

func (w *WritableBase) V8FuncEnd(in isolates.FunctionArgs) (*isolates.Value, error)

func (*WritableBase) V8FuncSetDefaultEncoding

func (w *WritableBase) V8FuncSetDefaultEncoding(in isolates.FunctionArgs) (*isolates.Value, error)

func (*WritableBase) V8FuncUncork

func (w *WritableBase) V8FuncUncork(in isolates.FunctionArgs) (*isolates.Value, error)

func (*WritableBase) V8FuncWrite

func (w *WritableBase) V8FuncWrite(in isolates.FunctionArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritable

func (w *WritableBase) V8GetWritable(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritableAborted

func (w *WritableBase) V8GetWritableAborted(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritableCorked

func (w *WritableBase) V8GetWritableCorked(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritableEnded

func (w *WritableBase) V8GetWritableEnded(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritableFinished

func (w *WritableBase) V8GetWritableFinished(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritableHighWaterMark

func (w *WritableBase) V8GetWritableHighWaterMark(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritableLength

func (w *WritableBase) V8GetWritableLength(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritableNeedDrain

func (w *WritableBase) V8GetWritableNeedDrain(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) V8GetWritableObjectMode

func (w *WritableBase) V8GetWritableObjectMode(in isolates.GetterArgs) (*isolates.Value, error)

func (*WritableBase) Writable

func (w *WritableBase) Writable() bool

func (*WritableBase) WritableAborted

func (w *WritableBase) WritableAborted() bool

func (*WritableBase) WritableCorked

func (w *WritableBase) WritableCorked() int

func (*WritableBase) WritableEnded

func (w *WritableBase) WritableEnded() bool

func (*WritableBase) WritableFinished

func (w *WritableBase) WritableFinished() bool

func (*WritableBase) WritableHighWaterMark

func (w *WritableBase) WritableHighWaterMark() int

func (*WritableBase) WritableLength

func (w *WritableBase) WritableLength() int

func (*WritableBase) WritableNeedDrain

func (w *WritableBase) WritableNeedDrain() bool

func (*WritableBase) WritableObjectMode

func (w *WritableBase) WritableObjectMode() bool

func (*WritableBase) WritableWrite

func (w *WritableBase) WritableWrite(ctx context.Context, args ...any) error

func (*WritableBase) Write

func (c *WritableBase) Write(b []byte) (int, error)

type WriteCloser

type WriteCloser struct {
    *Closer
    *Writer
}

func NewWriteCloser

func NewWriteCloser(in isolates.FunctionArgs) (*WriteCloser, error)

func (*WriteCloser) Final

func (c *WriteCloser) Final(in isolates.FunctionArgs, this Writable, callback *isolates.Value) error

func (*WriteCloser) V8FuncFinal

func (c *WriteCloser) V8FuncFinal(in isolates.FunctionArgs) (*isolates.Value, error)

type Writer

type Writer struct {
    io.Writer
    // contains filtered or unexported fields
}

func NewWriter

func NewWriter(in isolates.FunctionArgs) (*Writer, error)

func (*Writer) V8FuncWrite

func (c *Writer) V8FuncWrite(in isolates.FunctionArgs) (*isolates.Value, error)

func (*Writer) Write

func (c *Writer) Write(in isolates.FunctionArgs, this Writable, chunk *isolates.Value, encoding string, callback *isolates.Value) error

Up next

tty