My first meaningful program on Erland(OTP)/Cowboy/Erlydtl/Mnesia
Reconfigure src/pastebin.app.src and run:
$ rebar compile
$ echo "My copy paste!" | curl -F 'file=<-' <your_hostname>
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
To show progress add -#/--progress-bar option and/or pipe result to more
$ curl -F 'file=@data.csv' <your_hostname> | more
$ cat myfile | curl --progress-bar -F 'file=<-' <your_hostname> | more
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
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
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 ;)
$ 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