DEV Community

Cover image for qrcp: transfer files over wi-fi from your computer to your mobile device by scanning a QR code without leaving the terminal

qrcp: transfer files over wi-fi from your computer to your mobile device by scanning a QR code without leaving the terminal

claudiodangelis profile image claudio d'angelis ・4 min read

Hello everyone, here's a project that I have been working on in the last couple years. It's called qrcp and it's a command line tool to transfer files over Wi-Fi from your computer to a mobile device by scanning a QR code without leaving the terminal.

How does it work?


qrcp binds a web server to the address of your Wi-Fi network interface on a random port and creates a handler for it. The default handler serves the content and exits the program when the transfer is complete. When used to receive files, qrcp serves an upload page and handles the transfer.

The tool prints a QR code that encodes the text:


Most QR apps can detect URLs in decoded text and act accordingly (i.e. open the decoded URL with the default browser), so when the QR code is scanned the content will begin downloading by the mobile browser.

Send files to mobile:


Receive files from mobile:



Install the latest development version with Go

Note: it requires go 1.8

go get

Check the full GitHub's README for all the installation options: installing qrcp.

Sending files

Send a file

qrcp MyDocument.pdf

Send multiple files at once

When sending multiple files at once, qrcp creates a zip archive of the files or folders you want to transfer, and deletes the zip archive once the transfer is complete.

# Multiple files
qrcp MyDocument.pdf IMG0001.jpg
# A whole folder
qrcp Documents/

Zip a file before transferring it

You can choose to zip a file before transferring it.

qrcp --zip LongVideo.avi

Receive files

When receiving files, qrcp serves an "upload page" through which you can choose files from your mobile.

Receive files to the current directory

qrcp receive

Receive files to a specific directory

# Note: the folder must exist
qrcp receive --output=/tmp/dir


qrcp works without any prior configuration, however, you can choose to configure to use specific values. The config command launches a wizard that lets you configure parameters like interface, port, fully-qualified domain name and keep alive.

qrcp config

Note: if some network interfaces are not showing up, use the --list-all-interfaces flag to suppress the interfaces' filter.

qrcp --list-all-interfaces config 

Configuration File

The default configuration file is stored in $HOME/qrcp.json, however, you can specify the location of the config file by passing the --config flag:

qrcp --config /tmp/qrcp.json MyDocument.pdf


By default qrcp listens on a random port. Pass the --port (or -p) flag to choose a specific one:

qrcp --port 8080 MyDocument.pdf

Network Interface

qrcp will try to automatically find the suitable network interface to use for the transfers. If more than one suitable interface is found, it asks you to choose one.

If you want to use a specific interface, pass the --interface (or -i) flag:

# The webserver will be visible by
# all computers on the tun0's interface network
qrcp -i tun0 MyDocument.dpf

You can also use a special interface name, any, which binds the web server to, making the web server visible by everyone on any network, even from an external network.

This is useful when you want to transfer files from your Amazon EC2, Digital Ocean Droplet, Google Cloud Platform Compute Instance or any other VPS.

qrcp -i any MyDocument.pdf


qrcp uses two patterns for the URLs:

  • send: http://{ip address}:{port}/send/{random path}
  • receive: http://{ip address}:{port}/receive/{random path}

A few options are available that override these patterns.

Pass the --path flag to use a specific path for URLs, for example:

# The resulting URL will be
# http://{ip address}:{port}/send/x
qrcp --path=x MyDocument.pdf

Pass the --fqdn (or -d) to use a fully qualified domain name instead of the IP. This is useful in combination with -i any you are using it from a remote location:

# The resulting URL will be
qrcp --fqdn -i any -p 8080 MyRemoteDocument.pdf


qrcp supports secure file transfers with HTTPS. To enable secure transfers you need a TLS certificate and the associated key.

You can choose the path to the TLS certificate and keys from the qrcp config wizard, or, if you want, you can pass the --tls-cert and --tls-key:

qrcp --tls-cert /path/to/cert.pem --tls-key /path/to/cert.key MyDocument

A --secure flag is available too, you can use it to override the default value.

Open in browser

If you need a QR to be printed outside your terminal, you can pass the --browser flag. With this flag, qrcp will still print the QR code to the terminal, but it will also open a new window of your default browser to show the QR code.

qrcp --browser MyDocument.pdf

Keep the server alive

It can be useful to keep the server alive after transferring the file, for example, when you want to transfer the same file to multiple devices. You can use the --keep-alive flag for that:

# The server will not shutdown automatically
# after the first transfer
qrcp --keep-alive MyDocument.pdf

Shell completion scripts

qrcp comes with a built-in completion command that generates shell completion scripts. Check the shell completion section of the README for more information.

Future of the development

I would like to add a few more features to this tool in the future, like file encryption, ability be used after a pipe, and more.

If you give it a try, let me know how it goes! And am happy to answer your questions if you have.

The project home is at, and there is a Telegram channel available if you want to receive news about the development: qrcp Telegram channel.


Discussion (0)

Editor guide