pastes

Crates.iopastes
lib.rspastes
version0.1.3
sourcesrc
created_at2023-05-23 06:38:01.550463
updated_at2023-05-25 19:51:41.605228
descriptionPastes is a simple tool to upload files and text to pastes.dev or bytebin.lucko.me
homepagehttps://github.com/funnyboy-roks/pastes
repositoryhttps://github.com/funnyboy-roks/pastes
max_upload_size
id871749
size66,249
Funny (funnyboy-roks)

documentation

README

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!

Commit count: 10

cargo fmt