Skip to content

jkawamoto/go-pixeldrain

Repository files navigation

A Pixeldrain client

MIT License Go application Go Reference codecov Release

Usage

Upload files

pd upload <path[:name]>...

upload command uploads files specified by the given paths to Pixeldrain and shows a URL to download them. Each path can have an optional name. If a name is given, uploaded file will be renamed with it.

For example, this command reads img.png and uploads it as another.png:

pd upload img.png:another.png

If path is -, the uploading file is read from stdin. In this case, it's recommended to give a file name. For example, this command reads data from stdin and uploads it as output.log:

pd upload -:output.log

If multiple files are given, an album consists of them will be created. By default, the album has a random name. --album flag can specify the name. For example, this command uploads two files and creates an album named screenshots:

pd upload --album screenshots img1.png img2.png

Upload a directory

Since this application supports uploading a file from STDIN, you can upload a directory with tar command. For example, this command uploads ~/Documents directory:

tar zcf - ~/Documents | pd upload -:documents.tar.gz

Upload to your account

If you want to upload files to your account, give your API key with --api-key flag or via PIXELDRAIN_API_KEY environment variable.

An API key can be obtained from https://pixeldrain.com/user/api_keys.

Download files

pd download <URL>...

download command downloads files from Pixeldrain and stores it in the current directory by default.

If --dir or -o option is given with a directory path, the downloaded file is stored in the directory.

If the given URL refers an album which consists of multiple files, this command asks which file you want to download. If you want to download all files without any interaction, use --all flag.

End-to-end encryption

If recipients are specified with --recipient and/or --recipient-file flags to upload command, files will be encrypted before being uploaded by age. Encrypted files will have extension .age.

A recipient specified with --recipient flag can be an age public key generated by age-keygen ("age1...") or an SSH public key ("ssh-ed25519 AAAA...", "ssh-rsa AAAA..."). A recipient file specified with --recipient-file flag contains one or more recipients, one per line. Empty line sand lines starting with "#" are ignored as comments.

If a downloading file has extension .age and an identity file is specified with --identity flag to download command, the file will be decrypted.

An identity contains one or more secret keys ("AGE-SECRET-KEY-1..."), one per line, or an SSH key. Empty lines and lines starting with "#" are ignored as comments.

See age for the details of age and age-keygen.

Installation

If you're a Homebrew or Linuxbrew user, you can install this app by the following commands:

$ brew tap jkawamoto/pixeldrain
$ brew install pixeldrain

To build the newest version, use go get command:

$ go get github.com/jkawamoto/go-pixeldrain

Otherwise, compiled binaries are also available in GitHub.

License

This software is released under the MIT License, see LICENSE.