Skip to content

Commit 8a21ae4

Browse files
committed
use MiB and KiB
1 parent 3fc0cdb commit 8a21ae4

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

mongo/gridfs/bucket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
// TODO: add sessions options
3131

3232
// DefaultChunkSize is the default size of each file chunk.
33-
const DefaultChunkSize int32 = 255 * 1000 // 255 KB
33+
const DefaultChunkSize int32 = 255 * 1024 // 255 KiB
3434

3535
// ErrFileNotFound occurs if a user asks to download a file with a file ID that isn't found in the files collection.
3636
var ErrFileNotFound = errors.New("file with given parameters not found")

mongo/gridfs/upload_stream.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
// UploadBufferSize is the size in bytes of one stream batch. Chunks will be written to the db after the sum of chunk
2323
// lengths is equal to the batch size.
24-
const UploadBufferSize = 16 * 1000000 // 16 MB
24+
const UploadBufferSize = 16 * 1024 * 1024 // 16 MiB
2525

2626
// ErrStreamClosed is an error returned if an operation is attempted on a closed/aborted stream.
2727
var ErrStreamClosed = errors.New("stream is closed or aborted")

mongo/options/gridfsoptions.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package options
99
import (
1010
"time"
1111

12+
"github.com/mongodb/mongo-go-driver/mongo/gridfs"
1213
"github.com/mongodb/mongo-go-driver/mongo/readconcern"
1314
"github.com/mongodb/mongo-go-driver/mongo/readpref"
1415
"github.com/mongodb/mongo-go-driver/mongo/writeconcern"
@@ -19,7 +20,7 @@ import (
1920
var DefaultName = "fs"
2021

2122
// DefaultChunkSize is the default size of each file chunk in bytes.
22-
var DefaultChunkSize int32 = 255 * 1000
23+
var DefaultChunkSize = gridfs.DefaultChunkSize
2324

2425
// DefaultRevision is the default revision number for a download by name operation.
2526
var DefaultRevision int32 = -1

0 commit comments

Comments
 (0)