Skip to content

NickRI/pastebin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pastebin

My first meaningful program on Erland(OTP)/Cowboy/Erlydtl/Mnesia

Requirements

Compilation

Reconfigure src/pastebin.app.src and run:

$ rebar compile

Usage

Add data

$ echo "My copy paste!" | curl -F 'file=<-' <your_hostname>

Upload file

All uploads act as multipart forms by POST

$ cat myfile.txt | curl -F 'file=<-' <your_hostname>

You can also add name to your paste

$ echo "Nick; Age; Email;" | curl -F 'name=data.csv' -F 'file=<-' <your_hostname>
$ cat myvid.wmv | curl -F 'name=coolvid.wmv' -F 'file=<-' <your_hostname>

Or just upload file with filename

$ curl -F 'file=@data.csv' <your_hostname>

If file is already exist than you will get old link

Progress

To show progress add -#/--progress-bar option and/or pipe result to more

Standard progress

$ curl -F 'file=@data.csv' <your_hostname> | more

Progress bar

$ cat myfile | curl --progress-bar -F 'file=<-' <your_hostname> | more

Change the link

To update associated file you must use binary PUT method

$ curl --upload-file file <your_hostname>/7gxCXz | more

will update file with link 7gxCXz with basic progress panel, if link not exists than error message will returns

Delete link

To delete link from service you must use DELETE method.

$ curl -X DELETE <your_hostname>/7gxCXz

will delete id=7gxCXz or error message if link not exist

Get data

To console output

$ curl <your_hostname>/{XXXXX}

Output to disk

$ curl <your_hostname>/{XXXXX} > mypaste.txt

To save data with content-disposition[filename] and content-type

$ curl <your_hostname>/{XXXXX} -O -J

If 'name' wasn't set during upload then you have random file name

Also you can use browser to download any file ;)

Client install

$ curl <your_hostname>/client -O -J #Thats will download pastebin
$ chmod a+x pastebin
# mv pastebin /usr/local/bin # Optional
$ pastebin <file>

Client can also download whole folders.

p.s. Fast and furious, not mem/cpu devourer even on Gb uploads/downloads))

25.05.2015

About

Yet another pastebin server app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published