#text-file #upload #file-extension #file-upload #dev #pastebin #bytebin

app pastes

Pastes is a simple tool to upload files and text to pastes.dev or bytebin.lucko.me

4 releases

0.1.3 May 25, 2023
0.1.2 May 24, 2023
0.1.1 May 23, 2023
0.1.0 May 23, 2023

#1881 in Command line utilities

31 downloads per month

Apache-2.0

21KB
263 lines

Pastes CLI

A cli tool to upload files to pastes.dev or bytebin.lucko.me

The program will attempt to determine the file type based on the extension, and thus, whether it should be uploaded to pastebin or

Usage

pastes can be run as a single command

$ pastes my_text_file.txt # Upload a text file to pastes.dev
$ pastes my_image.png # Upload an image to bytebin.lucko.me

$ pastes my_unknown_file # Upload to bytebin
$ pastes my_unknown_file --pastes # Upload to pastebin (read the file as plaintext)
$ pastes my_unknown_file --bytebin # Upload to bytebin

$ pastes ... -t application/json # Force application/json mime type

Or, it can be run in a pipeline

$ echo "hello" | pastes --json | jq '.url'
$ cat my_file.txt | pastes -t text/plain
# Is equivalent to
$ pastes my_file.txt -t text/plain

For full usage see pastes --help

Platforms

While this project has been built with Linux in mind, it should theoretically work on other platforms.

Install

cargo install pastes

Todo

A few items on the todo list:

  • Add the ability to download from pastes.dev and bytebin
    • Either detecting in the url itself or add a --download flag that will treat the file as a url or key
    • Use the mime2ext crate to guess the file extension and write to that
  • Perhaps switch to tokio and non-blocking reqwest to allow streams
    • Via stream feature on reqwest (which requires tokio)
  • Add ability to use alternate locations hosting paste/bytebin instances
  • More mimetype matching to determine which service to use

Contributing

Please feel free to open an issue or pull request if you find a bug or have a feature idea. I'm always open to help on all projects!

Dependencies

~6–21MB
~297K SLoC