Update readme with better upload commands

This commit is contained in:
lucko
2022-09-21 23:21:09 +01:00
committed by GitHub
parent 0875d10fb9
commit e995261d87

View File

@@ -5,22 +5,59 @@
**paste is a simple web app for writing & sharing code.** It's my own take on conventional pastebin sites like _pastebin.com_ or _hastebin_. **paste is a simple web app for writing & sharing code.** It's my own take on conventional pastebin sites like _pastebin.com_ or _hastebin_.
Anyone can use paste! The official/public instance can be accessed using the endpoints listed below, but you can also [host your own](#host-your-own) if you like! Anyone can use paste! The official/public instance can be accessed using the endpoints listed below, but you can also [host your own](#host-your-own) if you like!
##### 1) In a Web Browser ##### 1) In a Web Browser
Just go to https://pastes.dev! Just go to https://pastes.dev!
##### 2) From the Command Line ##### 2) From the Command Line
You can submit content using netcat. You can submit content most easily using [curl](https://curl.se/docs/manpage.html).
```shell
# Upload the contents of a file
> curl -T example.txt https://api.pastes.dev/post
# Upload the contents of a file and specify the language
> curl -T example.yml -H "Content-Type: text/yaml" https://api.pastes.dev/post
# Pipe in some output from any command
> echo "Hello world" | curl -T - https://api.pastes.dev/post
```
<details>
<summary>If curl isn't installed on your system, you can also post using <b>netcat</b>.</summary>
```shell ```shell
# Pipe in some output from any command # Pipe in some output from any command
> echo "Hello world" | nc nc.pastes.dev 1337 > echo "Hello world" | nc nc.pastes.dev 1337
# Upload the contents of a file # Upload the contents of a file
> cat example123.txt | nc nc.pastes.dev 1337 > cat example.txt | nc nc.pastes.dev 1337
```
</details>
<details>
<summary>If you don't want to do so much typing, you can create a shorter <b>alias</b>.</summary>
```bash
# Add this to the end of `~/.bashrc` and run 'source ~/.bashrc'
paste() {
curl -T $1 https://api.pastes.dev/post
}
``` ```
##### 3) With the API then...
Send GET/POST requests to `https://api.pastes.dev/`. More info [below](#pastesdev-api).
```shell
# Upload the contents of a file
> paste example.txt
# Pipe in some output from any command
> echo "Hello!" | paste -
```
</details>
##### 3) From Code
Send GET/POST/PUT requests to `https://api.pastes.dev/`. More info [below](#pastesdev-api).
___ ___