Upload-file command

Uploads one file to the given bucket. Uploads the contents of the local file, and assigns the given name to the B2 file.

By default, upload_file will compute the sha1 checksum of the file to be uploaded. But, if you already have it, you can provide it on the command line to save a little time.

Content type is optional. If not set, it will be set based on the file extension.

By default, the file is broken into as many parts as possible to maximize upload parallelism and increase speed. The minimum that B2 allows is 100MB. Setting --minPartSize to a larger value will reduce the number of parts uploaded when uploading a large file.

The maximum number of upload threads to use to upload parts of a large file is specified by --threads. It has no effect on small files (under 200MB). Default is 10.

If the tqdm library is installed, progress bar is displayed on stderr. Without it, simple text progress is printed. Use --noProgress to disable progress reporting.

Each fileInfo is of the form a=b.

To request SSE-B2 encryption for destination files, please set --destinationServerSideEncryption=SSE-B2. The default algorithm is set to AES256 which can by changed with --destinationServerSideEncryptionAlgorithm parameter.

Requires capability:

  • writeFiles

b2 upload-file [-h] [--noProgress] [--quiet] [--contentType CONTENTTYPE]
               [--minPartSize MINPARTSIZE] [--sha1 SHA1] [--threads THREADS]
               [--info INFO] [--destinationServerSideEncryption {SSE-B2}]
               [--destinationServerSideEncryptionAlgorithm {AES256}]
               bucketName localFilePath b2FileName

Positional Arguments


Named Arguments


Default: False


Default: False


Default: 10


Default: []


Possible choices: SSE-B2


Possible choices: AES256

Default: “AES256”