Versions in this module Expand all Collapse all v1 v1.1.0 May 26, 2022 v1.0.0 May 26, 2022 Changes in this version + const DefaultChunkSize + const UploadBufferSize + var ErrFileNotFound = errors.New("file with given parameters not found") + var ErrStreamClosed = errors.New("stream is closed or aborted") + var ErrWrongIndex = errors.New("chunk index does not match expected index") + var ErrWrongSize = errors.New("chunk size does not match expected size") + type Bucket struct + func NewBucket(db *mongo.Database, opts ...*options.BucketOptions) (*Bucket, error) + func (b *Bucket) Delete(fileID interface{}) error + func (b *Bucket) DownloadToStream(fileID interface{}, stream io.Writer) (int64, error) + func (b *Bucket) DownloadToStreamByName(filename string, stream io.Writer, opts ...*options.NameOptions) (int64, error) + func (b *Bucket) Drop() error + func (b *Bucket) Find(filter interface{}, opts ...*options.GridFSFindOptions) (*mongo.Cursor, error) + func (b *Bucket) OpenDownloadStream(fileID interface{}) (*DownloadStream, error) + func (b *Bucket) OpenDownloadStreamByName(filename string, opts ...*options.NameOptions) (*DownloadStream, error) + func (b *Bucket) OpenUploadStream(filename string, opts ...*options.UploadOptions) (*UploadStream, error) + func (b *Bucket) OpenUploadStreamWithID(fileID interface{}, filename string, opts ...*options.UploadOptions) (*UploadStream, error) + func (b *Bucket) Rename(fileID interface{}, newFilename string) error + func (b *Bucket) SetReadDeadline(t time.Time) error + func (b *Bucket) SetWriteDeadline(t time.Time) error + func (b *Bucket) UploadFromStream(filename string, source io.Reader, opts ...*options.UploadOptions) (primitive.ObjectID, error) + func (b *Bucket) UploadFromStreamWithID(fileID interface{}, filename string, source io.Reader, ...) error + type DownloadStream struct + func (ds *DownloadStream) Close() error + func (ds *DownloadStream) Read(p []byte) (int, error) + func (ds *DownloadStream) SetReadDeadline(t time.Time) error + func (ds *DownloadStream) Skip(skip int64) (int64, error) + type Upload struct + type UploadStream struct + FileID interface{} + func (us *UploadStream) Abort() error + func (us *UploadStream) Close() error + func (us *UploadStream) SetWriteDeadline(t time.Time) error + func (us *UploadStream) Write(p []byte) (int, error)