qrcp
:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.
Top Related Projects
Easily and securely send things from one computer to another :crocodile: :package:
VS Code in the browser
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:
-
Install
qrcp
on your computer. You can download the binary from the GitHub releases page or use a package manager likebrew
,apt
, orchoco
. -
Open a terminal and navigate to the directory containing the file you want to transfer.
-
Run the following command to start the file transfer:
qrcp send <filename>
This will start a local web server and display a QR code.
-
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
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)
})
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
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
$ qrcp
Transfer files over Wi-Fi from your computer to a mobile device by scanning a QR code without leaving the terminal.
You can support development by donating with .
Join the Telegram channel qrcp_dev or the @qrcp_dev Twitter account for news about the development.
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:
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.
Demo
Send files to mobile:
Receive files from mobile:
Installation
Using Go (Latest Development Version)
Requires Go 1.18 or later:
go install github.com/claudiodangelis/qrcp@latest
Prebuilt Binaries
Download the latest release for your platform from the Releases page.
Platform | Instructions |
---|---|
Linux | Extract the .tar.gz archive, move the binary to /usr/local/bin , and set permissions. |
Windows | Extract the .tar.gz archive and place the .exe file in a directory in your PATH . |
macOS | Extract the .tar.gz archive, move the binary to /usr/local/bin , and set permissions. |
Package Managers
Platform | Package Manager | Command |
---|---|---|
Linux | ArchLinux (AUR) | yay -S qrcp-bin or yay -S qrcp |
Linux | Debian/Ubuntu | sudo dpkg -i qrcp_<version>_linux_x86_64.deb |
Linux | CentOS/Fedora | sudo rpm -i qrcp_<version>_linux_x86_64.rpm |
Windows | WinGet | winget install --id=claudiodangelis.qrcp -e |
Windows | Scoop | scoop install qrcp |
Windows | Chocolatey | choco install qrcp |
macOS | Homebrew | brew install qrcp |
Confirm Installation
After installation, verify that qrcp
is working:
qrcp --help
Usage
Send Files
Action | Command Example |
---|---|
Send a file | qrcp MyDocument.pdf |
Send multiple files | qrcp MyDocument.pdf IMG0001.jpg |
Send a folder | qrcp Documents/ |
Zip before transferring | qrcp --zip LongVideo.avi |
Receive Files
Action | Command Example |
---|---|
Receive to current directory | qrcp receive |
Receive to a specific directory | qrcp receive --output=/tmp/dir |
Configuration
qrcp
works without prior configuration, but you can customize it using a configuration file or environment variables.
Configuration File
The default configuration file is stored in $XDG_CONFIG_HOME/qrcp/config.yml
. You can specify a custom location using the --config
flag:
qrcp --config /tmp/qrcp.yml MyDocument.pdf
Configuration Options
Key | Type | Description |
---|---|---|
interface | String | Network interface to bind the web server to. Use any to bind to 0.0.0.0 . |
bind | String | Address to bind the web server to. Overrides interface . |
port | Integer | Port to use. Defaults to a random port. |
path | String | Path to use in the URL. Defaults to a random string. |
output | String | Default directory to receive files. Defaults to the current working directory. |
fqdn | String | Fully qualified domain name to use in the URL instead of the IP address. |
keep-alive | Bool | Keep the server alive after transferring files. Defaults to false . |
secure | Bool | Use HTTPS instead of HTTP. Defaults to false . |
tls-cert | String | Path to the TLS certificate. Used only when secure: true . |
tls-key | String | Path to the TLS key. Used only when secure: true . |
Environment Variables
All configuration parameters can also be set via environment variables prefixed with QRCP_
:
$QRCP_INTERFACE
$QRCP_PORT
$QRCP_KEEPALIVE
Advanced Usage
Network Interface
To use a specific network interface:
qrcp -i tun0 MyDocument.pdf
To bind the web server to all interfaces:
qrcp -i any MyDocument.pdf
HTTPS
Enable secure transfers with HTTPS by providing a TLS certificate and key:
qrcp --tls-cert /path/to/cert.pem --tls-key /path/to/cert.key MyDocument.pdf
Shell Completion
qrcp
provides shell completion scripts for Bash, Zsh, and Fish.
Shell | Command Example |
---|---|
Bash | source <(qrcp completion bash) |
Zsh | qrcp completion zsh > "${fpath[1]}/_qrcp" |
Fish | `qrcp completion fish |
Authors and Credits
- Author: Claudio d'Angelis
- Logo: Provided by @arasatasaygin as part of the openlogos initiative.
- Releases: Managed with goreleaser.
Clones and Similar Projects
Project Name | Description |
---|---|
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 , written with C# and .NET Core, works for Windows. |
swift_file | Rust project inspired by qrcp . |
qrcp-android | Android app inspired by qrcp . |
License
MIT. See LICENSE.
Top Related Projects
Easily and securely send things from one computer to another :crocodile: :package:
VS Code in the browser
A simple zero-config tool to make locally trusted development certificates with any names you'd like.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot