diff options
| author | Petter Rasmussen | 2015-03-21 11:45:14 +0100 |
|---|---|---|
| committer | Petter Rasmussen | 2015-03-21 11:45:14 +0100 |
| commit | dfbac8d30dfd5ad21299cce6d8561f53685acc08 (patch) | |
| tree | ac2aa3a167b30ca3aae11dce79509fb0deeb353d | |
| parent | d3dccc501b365682fd2542b61e53da56f99e5ae2 (diff) | |
| download | gdrive-dfbac8d30dfd5ad21299cce6d8561f53685acc08.tar.bz2 | |
Add flag to override the transfer chunk size
Increasing the chunk size might give you faster upload speeds
if you are on a fast connection, see #49.
| -rw-r--r-- | drive.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2,6 +2,7 @@ package main import ( "fmt" + "github.com/prasmussen/google-api-go-client/googleapi" "github.com/prasmussen/gdrive/cli" "github.com/prasmussen/gdrive/gdrive" "github.com/prasmussen/gdrive/util" @@ -47,6 +48,7 @@ type Options struct { Share bool `goptions:"--share, description='Share uploaded file'"` MimeType string `goptions:"--mimetype, description='The MIME type (default will try to figure it out)'"` Convert bool `goptions:"--convert, description='File will be converted to Google Docs format'"` + ChunkSize int64 `goptions:"-C, --chunksize, description='Set chunk size in bytes. Minimum is 262144, default is 1048576. Recommended to be a power of two.'"` } `goptions:"upload"` Download struct { @@ -104,6 +106,12 @@ func main() { case "upload": args := opts.Upload + + // Set custom chunksize if given + if args.ChunkSize >= (1 << 18) { + googleapi.SetChunkSize(args.ChunkSize) + } + if args.Stdin { err = cli.UploadStdin(drive, os.Stdin, args.Title, args.ParentId, args.Share, args.MimeType, args.Convert) } else { |
