CLI

This article will tell you how you can use the Filemail CLI tool

Installation instructions

Install NodeJS v20 or above (minimum required version)

  1. Install Filemail CLI using NPM with following command

    npm install -g filemail-cli

Test upload of a file with the CLI:

filemail upload testFile.txt -u [email protected]

Available commands (run filemail -h to learn more)

Usage: filemail [options] [command]

CLI for sending files to Filemail.com.

Options:
  -V, --version                output the version number
  -h, --help                   display help for command

Commands:
  login [options] <username>   Login to Filemail API and get login token.
  logout <logintoken>          Logout from Filemail API and destroy login token.
  upload [options] <files...>  Upload files to Filemail.com.
  help [command]               display help for command

Store password and settings in a json file for safety and convenience

You can create a json config file to store your password and other settings. Thanks to this you won't need to pass them as arguments. An example json file containing username, password and from parameter value settings:

{ 
   "username": "[email protected]", 
   "password": "myS3cretP4ssword", 
   "from": "[email protected]" 
} 

You can then use it with CLI passing it with --config-file option. For example: ​filemail upload testFile.txt --config-file "c:\filemail-config.json"

All supported upload options (run filemail upload --help to learn more)

Option
Description

-g, --config-file <file>

JSON file with configuration to apply.

-b, --log-file <file>

Log file to save logs to.

-r, --api-retry-limit <number>

Retry limit for API calls. (default: 3)

-d, --log-level <string>

Logging level of the file logger. (Choices: Error, Warning, Info, Debug, Trace – default: Info)

--api-request-total-timeout <ms>

Request total timeout in milliseconds. (default: no timeout)

-u, --username <string>

Your username for Filemail.com. Ignored if --logintoken option is present.

-p, --password <string>

Your password for Filemail.com. If not provided and not in config file, CLI will prompt for it.

-l, --logintoken <string>

Authentication token from Filemail API.

-t, --to <string...>

Recipient e-mail addresses (space separated, without quotation marks).

--from <string>

Sender’s e-mail address.

--subject <string>

Transfer subject.

-m, --message <string>

Transfer message.

-n, --notify <boolean>

Get email notification every time a file is downloaded.

-c, --confirmation <boolean>

Send confirmation when files have been successfully sent.

-d, --days <number>

Number of days files should be available to download. Defaults to account setting if not specified.

--upload-password <string>

Password you want to use to secure the transfer.

--no-progress-bar

Hide upload progress bar.

--no-infinite-retries

Application exits as soon as any chunk’s retry limit exceeds --chunk-upload-retry-limit.

-k, --max-chunks-upload-in-parallel <number>

Maximum number of chunks to upload simultaneously. (default: 9)

--chunk-upload-retry-limit <number>

Retry limit for file chunks upload. (default: 3)

-e, --e2ee-key <string>

End-to-end encryption key you want to use to encrypt the transfer.

-x, --max-chunk-size <number>

Maximum size of a single file chunk in bytes. (default: 5 MB)

--upload-idle-timeout <ms>

Upload idle timeout in milliseconds. Time out inactive connections. (default: 90 sec)

-h, --help

Display help for command.

The application will exit with code 0 if transfer was successful, otherwise it failed and you might want to check parameters and retry.

Example:

This example will send 2 files (file1.txt and log.log) and a folder (/myFolder) to 3 recipients ([email protected], [email protected] and [email protected]) from the user [email protected] having set an E2EE key to superPassword

filemail upload --username [email protected] --e2ee-key superPassword --to [email protected] [email protected] [email protected] -- c:\file1.txt c:\log.log c:\myFolder

Last updated

Was this helpful?