Convert Figma logo to code with AI

claudiodangelis logoqrcp

:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.

10,036
533
10,036
24

Top Related Projects

28,343

Easily and securely send things from one computer to another :crocodile: :package:

VS Code in the browser

51,244

A simple zero-config tool to make locally trusted development certificates with any names you'd like.

Quick Overview

qrcp is a tool that allows you to quickly transfer files from your computer to your smartphone (or any other device) using a QR code. It works by creating a local web server that serves the file, and then displaying a QR code that can be scanned by your smartphone to download the file.

Pros

  • Cross-platform: qrcp is available for Windows, macOS, and Linux, making it a versatile tool.
  • Easy to use: The command-line interface is straightforward, and the QR code makes the file transfer process simple.
  • No setup required: qrcp doesn't require any additional software or configuration on the receiving device, making it a quick and convenient solution.
  • Secure: The file transfer happens over a local network, ensuring the data remains private.

Cons

  • Limited file size: The maximum file size that can be transferred is limited by the available memory and network bandwidth.
  • Requires a QR code reader: The receiving device needs to have a QR code reader app installed, which may not be the case for all users.
  • No support for large file transfers: qrcp is not designed for transferring large files, as it may become slow and unreliable.
  • No support for multiple file transfers: qrcp can only transfer one file at a time, which may be inconvenient if you need to transfer multiple files.

Getting Started

To use qrcp, follow these steps:

  1. Install qrcp on your computer. You can download the binary from the GitHub releases page or use a package manager like brew, apt, or choco.

  2. Open a terminal and navigate to the directory containing the file you want to transfer.

  3. Run the following command to start the file transfer:

    qrcp send <filename>
    

    This will start a local web server and display a QR code.

  4. On your smartphone, open a QR code reader app and scan the displayed QR code. Your smartphone will then download the file.

That's it! qrcp makes it easy to quickly transfer files between your computer and smartphone without the need for any additional setup or configuration.

Competitor Comparisons

28,343

Easily and securely send things from one computer to another :crocodile: :package:

Pros of croc

  • Supports end-to-end encryption, ensuring secure file transfers.
  • Provides a simple and intuitive command-line interface.
  • Offers cross-platform compatibility, working on Windows, macOS, and Linux.

Cons of croc

  • Lacks the ability to generate QR codes, which is a feature provided by qrcp.
  • May have a steeper learning curve for users unfamiliar with the command-line interface.
  • Doesn't offer the same level of customization options as qrcp.

Code Comparison

Here's a brief comparison of the code for the send function in both projects:

qrcp (claudiodangelis/qrcp):

func send(c *cli.Context) error {
    file := c.Args().First()
    if file == "" {
        return errors.New("no file specified")
    }

    qrcode, err := qrcode.New(fmt.Sprintf("http://%s:%d/%s", c.String("host"), c.Int("port"), filepath.Base(file)), qrcode.Medium)
    if err != nil {
        return err
    }
    // ...
}

croc (schollz/croc):

func send(c *cli.Context) error {
    file := c.Args().First()
    if file == "" {
        return errors.New("no file specified")
    }

    code, err := croc.Send(file, c.String("relay"), c.Bool("no-local"), c.Bool("no-multi"), c.Bool("no-compress"), c.Bool("no-encrypt"), c.Int("port"), c.Int("code-length"))
    if err != nil {
        return err
    }
    // ...
}

Both functions handle the file input and set up the necessary parameters for the file transfer. The main difference is that qrcp generates a QR code, while croc uses a relay server and a code-based authentication system.

VS Code in the browser

Pros of Code Server

  • Code Server provides a web-based IDE, allowing developers to access and edit their code from any device with a web browser.
  • It supports a wide range of programming languages and features, including syntax highlighting, code completion, and debugging.
  • Code Server can be easily deployed on various cloud platforms, making it a versatile solution for remote development.

Cons of Code Server

  • Code Server requires more setup and configuration compared to qrcp, which is a simpler and more lightweight tool.
  • The web-based interface may not be as responsive or performant as a native IDE, especially for large projects or complex development tasks.
  • Code Server may have a higher resource footprint compared to qrcp, as it runs a full-fledged web server and IDE environment.

Code Comparison

Here's a brief comparison of the code for the two projects:

qrcp (claudiodangelis/qrcp):

func main() {
    app := cli.NewApp()
    app.Name = "qrcp"
    app.Usage = "Transfer files over wifi from your computer to your mobile device by scanning a QR code"
    app.Version = version
    app.Flags = []cli.Flag{
        // ...
    }
    app.Action = func(c *cli.Context) error {
        // ...
    }
    app.Run(os.Args)
}

Code Server (coder/code-server):

import { createServer } from 'http'
import { createApp } from './app'
import { createLogger } from './logger'
import { createRouter } from './router'
import { createStatic } from './static'
import { createWebsocket } from './websocket'

const logger = createLogger()
const app = createApp()
const router = createRouter(app)
const websocket = createWebsocket(app)
const staticServer = createStatic(app)

const server = createServer((req, res) => {
  app.handle(req, res)
})
51,244

A simple zero-config tool to make locally trusted development certificates with any names you'd like.

Pros of mkcert

  • mkcert is a simple tool that allows you to create locally-trusted development certificates, which can be useful for testing HTTPS-enabled web applications.
  • mkcert supports multiple platforms, including Windows, macOS, and Linux, making it a versatile tool.
  • mkcert automatically installs the generated certificates in the system's trusted root certificate store, simplifying the setup process.

Cons of mkcert

  • mkcert is primarily focused on generating development certificates, while qrcp is a more general-purpose file transfer tool.
  • mkcert does not provide any file transfer functionality, which is the main purpose of qrcp.
  • mkcert may not be as widely known or used as qrcp, which has a larger user base and more features.

Code Comparison

Here's a brief code comparison between the two projects:

qrcp (claudiodangelis/qrcp):

func main() {
    app := cli.NewApp()
    app.Name = "qrcp"
    app.Usage = "Transfer files over Wi-Fi from your computer to your mobile device by scanning a QR code."
    app.Version = version
    app.Flags = []cli.Flag{
        // ...
    }
    app.Action = func(c *cli.Context) error {
        // ...
    }
    app.Run(os.Args)
}

mkcert (FiloSottile/mkcert):

func main() {
    app := cli.NewApp()
    app.Name = "mkcert"
    app.Usage = "A simple tool for making locally-trusted development certificates"
    app.Version = version
    app.Flags = []cli.Flag{
        // ...
    }
    app.Action = func(c *cli.Context) error {
        // ...
    }
    app.Run(os.Args)
}

As you can see, both projects use the popular Go-based CLI framework, cli, to handle command-line arguments and execute the main functionality of the application.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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 or the @qrcp_dev Twitter account 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

Tutorials

Installation

Install the latest development version with Go

Note: it requires go 1.18

go install github.com/claudiodangelis/qrcp@latest

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

Raspberry Pi

The following ARM releases are available in the Releases page:

  • armv7
  • arm64

Using a package manager

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.

Scoop

If you use Scoop for package management on Windows, you can install qrcp with the following one-liner:

scoop install qrcp

Chocolatey

If you use Chocolatey for package management on Windows, you can install qrcp with the following one-liner:

choco install qrcp

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

Homebrew

If you use Homebrew for package management on macOS, you can install qrcp with the following one-liner:

brew install qrcp

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

Configuration

qrcp works without any prior configuration, however, you can choose to configure to use specific values.

To configure qrcp you can create a configuration file inside $XDG_CONFIG_HOME/qrcp.

Note: On Linux, the $XDG_CONFIG_HOME is .config under user home directory. So, for example, on Linux the configuration file will be $HOME/.config/qrcp/config.yml. On MacOS, it defaults to `$HOME/Library/Application Support/qrcp/config.yml``

Note: Starting from version 0.10.0, qrcp uses a YAML configuration file instead of the old JSON one. You can automatically migrate the legacy JSON format to the new YAML format by running qrcp config migrate.

KeyTypeNotes
interfaceStringThis value is automatically discovered during the first launch of qrcp, you can set it to override the default. You can use the any interface to bind the web server to 0.0.0.0.
bindStringThis value is used by qrcp to bind the web server to. Note: if this value is set, the interface parameter is ignored.
portIntegerWhen this value is not set, qrcp will pick a random port at any launch.
pathStringWhen this value is not set, qrcp will add a random string at the end of URL.
outputStringDefault directory to receive files to. If empty, the current working directory is used.
fqdnStringWhen this value is set, qrcp will use it to replace the IP address in the generated URL.
keepAliveBoolControls whether qrcp should quit after transferring the file. Defaults to false.
secureBoolControls whether qrcp should use HTTPS instead of HTTP. Defaults to false
tls-certStringPath to the TLS certificate. It's only used when secure: true.
tls-keyStringPath to the TLS key. It's only used when secure: true.
reversedBoolReverse QR code (black text on white background)?" true`.

All the configuration parameters can be controlled via environment variables prefixed with QRCP_, for example:

  • $QRCP_INTERFACE
  • $QRCP_PORT
  • $QRCP_KEEPALIVE
  • etc

Config Wizard

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 $XDG_CONFIG_HOME/qrcp/config.yml, however, you can specify the location of the config file by passing the --config flag:

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

Port

By default qrcp listens on a random port. Set the QRCP_PORT environment variable or pass the --port (or -p) flag to choose a specific one:

export QRCP_PORT=8080
qrcp MyDocument

Or:

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

Bind

Alternatively to choosing the interface, you can directly specify the address you want qrcp to bind the webserver to.

qrcp --bind 10.20.30.40 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

HTTPS

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.

Default output directory

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.

Bash:

$ source <(qrcp completion bash)

To load completions for each session, execute once:

Linux:

$ qrcp completion bash > /etc/bash_completion.d/qrcp

Note: if you don't want to install completion scripts system-wide, refer to Bash Completion FAQ.

MacOS:

$ qrcp completion bash > /usr/local/etc/bash_completion.d/qrcp

Zsh:

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:

$ echo "autoload -U compinit; compinit" >> ~/.zshrc

To load completions for each session, execute once:

$ qrcp completion zsh > "${fpath[1]}/_qrcp"

You will need to start a new shell for this setup to take effect.

Fish:

$ qrcp completion fish | source

To load completions for each session, execute once:

$ qrcp completion fish > ~/.config/fish/completions/qrcp.fish

Authors

qrcp, originally called qr-filetransfer, started from an idea of Claudio d'Angelis (@claudiodangelis on Telegram), 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

  • qr-fileshare - A similar idea executed in NodeJS with a React interface.
  • instant-file-transfer (Uncredited) - Node.js project similar to this
  • qr-filetransfer - Python clone of this project
  • qr-filetransfer - Another Node.js clone of this project
  • qr-transfer-node - Another Node.js clone of this project
  • QRDELIVER - Node.js project similar to this
  • qrfile - Transfer files by scanning a QR code
  • quick-transfer - Node.js clone of this project
  • share-file-qr - Python re-implementation of this project
  • share-files (Uncredited) - Yet another Node.js clone of this project
  • ezshare - Another Node.js two way file sharing tool supporting folders and multiple files
  • local_file_share - "share local file to other people, OR smartphone download files which is in pc"
  • qrcp - a desktop app clone of qrcp, writing with C# and .NET Core, work for Windows.
  • swift_file - Rust project inspired by qrcp.

License

MIT. See LICENSE.

NPM DownloadsLast 30 Days