alist/internal/model/args.go
Sean 15b7169df4
perf: multi-thread downloader, Content-Disposition (#4921)
general: enhance multi-thread downloader with cancelable context, immediately stop all stream processes when canceled;
feat(crypt): improve stream closing;
general: fix the bug of downloading files becomes previewing stream on modern browsers;

Co-authored-by: Sean He <866155+seanhe26@users.noreply.github.com>
Co-authored-by: Andy Hsu <i@nn.ci>
2023-08-04 15:29:54 +08:00

54 lines
1.3 KiB
Go

package model
import (
"github.com/alist-org/alist/v3/pkg/http_range"
"github.com/alist-org/alist/v3/pkg/utils"
"io"
"net/http"
"time"
)
type ListArgs struct {
ReqPath string
S3ShowPlaceholder bool
}
type LinkArgs struct {
IP string
Header http.Header
Type string
HttpReq *http.Request
}
type Link struct {
URL string `json:"url"`
Header http.Header `json:"header"` // needed header (for url) or response header(for data or writer)
RangeReadCloser RangeReadCloser // recommended way
ReadSeekCloser io.ReadSeekCloser // best for local,smb.. file system, which exposes ReadSeekCloser
Expiration *time.Duration // local cache expire Duration
IPCacheKey bool // add ip to cache key
//for accelerating request, use multi-thread downloading
Concurrency int
PartSize int
}
type OtherArgs struct {
Obj Obj
Method string
Data interface{}
}
type FsOtherArgs struct {
Path string `json:"path" form:"path"`
Method string `json:"method" form:"method"`
Data interface{} `json:"data" form:"data"`
}
type RangeReadCloser struct {
RangeReader RangeReaderFunc
Closers *utils.Closers
}
type WriterFunc func(w io.Writer) error
type RangeReaderFunc func(httpRange http_range.Range) (io.ReadCloser, error)