// OpenDownloadStreamByName opens a download stream for the file with the given filename.
OpenDownloadStreamByName opens a download stream for the file with the given filename.
// OpenDownloadStreamByName opens a download stream for the file with the given filename .
func (b *Bucket) OpenDownloadStreamByName(filename string, opts ...*options.NameOptions) (*DownloadStream, error) {
	var numSkip int32 = -1
	var sortOrder int32 = 1
	nameOpts := options.MergeNameOptions(opts...)
	if nameOpts.Revision != nil {
		numSkip = *nameOpts.Revision
	}
	if numSkip < 0 {
		sortOrder = -1
		numSkip = (-1 * numSkip) - 1
	}
	findOpts := options.Find().SetSkip(int64(numSkip)).SetSort(bsonx.Doc{{"uploadDate", bsonx.Int32(sortOrder)}})
	return b.openDownloadStream(bsonx.Doc{{"filename", bsonx.String(filename)}}, findOpts)
}
func ( b * Bucket ) OpenDownloadStreamByName ( filename string , opts ... * options . NameOptions ) ( * DownloadStream , error ) { var numSkip int32 = - 1 var sortOrder int32 = 1 nameOpts := options . MergeNameOptions ( opts ... ) if nameOpts . Revision != nil { numSkip = * nameOpts . Revision } if numSkip < 0 { sortOrder = - 1 numSkip = ( - 1 * numSkip ) - 1 } findOpts := options . Find ( ) . SetSkip ( int64 ( numSkip ) ) . SetSort ( bsonx . Doc { { " " , bsonx . Int32 ( sortOrder ) } } ) return b . openDownloadStream ( bsonx . Doc { { " " , bsonx . String ( filename ) } } , findOpts ) }
OpenDownloadStreamByName opens a download stream for the file with the given filename.
OpenDownloadStreamByName opens a download stream for the file with the given filename .