drive: add --drive-chunk-size and --drive-upload-cutoff parameters

This commit is contained in:
Nick Craig-Wood
2015-03-15 15:27:55 +00:00
parent 5cc5429f99
commit 7c120b8bc5
2 changed files with 29 additions and 8 deletions
+2 -6
View File
@@ -31,10 +31,6 @@ const (
// Number of times to try each chunk
maxTries = 10
// chunkSize is the size of the chunks created during a resumable upload and should be a power of two.
// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
chunkSize int64 = 1 << 18
)
// resumableUpload is used by the generated APIs to provide resumable uploads.
@@ -194,8 +190,8 @@ func (rx *resumableUpload) Upload() (*drive.File, error) {
var StatusCode int
for start < rx.ContentLength {
reqSize := rx.ContentLength - start
if reqSize >= chunkSize {
reqSize = chunkSize
if reqSize >= int64(chunkSize) {
reqSize = int64(chunkSize)
} else {
buf = buf[:reqSize]
}