Code Monkey home page Code Monkey logo

qrcp's Introduction

Logo

$ qrcp

Transfer files over Wi-Fi from your computer to a mobile device by scanning a QR code without leaving the terminal.

Go Report Card

You can support development by donating with Buy Me A Coffee.

Join the Telegram channel qrcp_dev for news about the development.

How does it work?

Screenshot

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:

http://{address}:{port}/{random_path}

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:

screenshot

Receive files from mobile:

Screenshot

Installation

Install the latest development version with Go

Note: it requires go 1.8

go get github.com/claudiodangelis/qrcp

Linux

Download the latest Linux .tar.gz archive from the Releases page, extract it, move the binary to the proper directory, then set execution permissions.

# Extract the archive
tar xf qrcp_0.5.0_linux_x86_64.tar.gz
# Copy the binary
sudo mv qrcp /usr/local/bin
# Set execution permissions
sudo chmod +x /usr/local/bin/qrcp

Using a package manager

Logo ArchLinux

Packages available on AUR:

Deb packages (Ubuntu, Debian, etc)

Download the latest .deb package from the Releases page, then run dpkg:

sudo dpkg -i qrcp_0.5.0_linux_x86_64.deb
# Confirm it's working:
qrcp version

RPM packages (CentOS, Fedora, etc)

Download the latest .rpm package from the Releases page, then run rpm:

sudo rpm -i qrcp_0.5.0_linux_x86_64.rpm
# Confirm it's working:
qrcp --help

Windows

Download the latest Windows .tar.gz archive from the Releases page and extract the EXE file.

MacOS

Download the latest macOS .tar.gz archive from the Releases page, extract it, move the binary to the proper directory, then set execution permissions.

# Extract the archive
tar xf qrcp_0.5.0_macOS_x86_64.tar.gz
# Copy the binary
sudo mv qrcp /usr/local/bin
# Set execution permissions
sudo chmod +x /usr/local/bin/qrcp
# Confirm it's working:
qrcp --help

Usage

Send 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

Options

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 

Port

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 0.0.0.0, 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

URL

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
# http://example.com:8080/send/xYz9
qrcp --fqdn example.com -i any -p 8080 MyRemoteDocument.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

Authors

qrcp, originally called qr-filetransfer, started from an idea of Claudio d'Angelis (@daw985 on Twitter), the current maintainer, and it's developed by the community.

Join us!

Credits

Logo is provided by @arasatasaygin as part of the openlogos initiative, a collection of free logos for open source projects.

Check out the rules to claim one: rules of openlogos.

Releases are handled with goreleaser.

Clones and Similar Projects

License

MIT. See LICENSE.

qrcp's People

Contributors

1hella avatar arkanosis avatar brualan avatar cehnegaitne avatar claudiodangelis avatar codeman99 avatar darienflamont avatar dpeukert avatar gs0510 avatar hellozee avatar i-dont-remember avatar joekyo avatar katakonst avatar mattn avatar mb-14 avatar mifi avatar paralax avatar paulorsf avatar rafa-acioly avatar sergeax avatar shivensinha4 avatar tssva avatar xjohn600 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.