steam

package
v1.64.54 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

README

流处理

package main

import (
	`context`
	`fmt`

	`github.com/aid297/aid/steam`
)

func main() {
	p := context.TODO()
	ctx := context.Background()
	steam.APP.Steam.New(
		steam.ReadCloser(nil), // HTTP 响应体或其他流
		steam.CopyFn(func(copied []byte) error {
			// 将 copied 已拷贝体复制到其他地方存储
			ctx = context.WithValue(p, "copy", copied)
			return nil // 当程序时,readCloser 会被重新填充
		}),
	)

	fmt.Printf(ctx.Value("copy").(string))
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APP struct{ Steam Steam }

Functions

This section is empty.

Types

type AttrCopyFn

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

func CopyFn

func CopyFn(fn func(copied []byte) error) AttrCopyFn

func (AttrCopyFn) Register

func (my AttrCopyFn) Register(steam *Steam)

type AttrReadCloser

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

func ReadCloser

func ReadCloser(readCloser io.ReadCloser) AttrReadCloser

func (AttrReadCloser) Register

func (my AttrReadCloser) Register(steam *Steam)

type Attributer

type Attributer interface {
	Register(steam *Steam)
}

type Steam

type Steam struct {
	Error error
	// contains filtered or unexported fields
}

func (Steam) Copy

func (my Steam) Copy() (io.ReadCloser, error)

Copy 复制流

func (Steam) New

func (Steam) New(attrs ...Attributer) Steam

New 实例化:Steam

func (Steam) SetAttrs added in v1.53.3

func (my Steam) SetAttrs(attrs ...Attributer) Steam

SetAttrs 设置属性

Jump to

Keyboard shortcuts

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