NOTE
The service is now invite-only. Please send an email at hello@chunk.io if you'd like to get access to the service.

Upload files from your terminal

$ curl -u user:pass -T path/to/file chunk.io
http://chunk.io/crohr/f1ec04b3586f415d9ae4cac7bbe64826

Tired of having to open a web browser to upload some files and make them available to people on the Web? Don’t want to remember a complicated API to do it on the command line? chunk.io is designed to be the simplest way to upload a file from the command line.

If your system does not have cURL, go install it right now.

Why ?

Every web site that allows you to upload files either requires you to open a web browser, and/or provides an API that’s just too complicated to be usable from the command-line. chunk.io solves this, and more:

And, your files are securely stored on Amazon S3.

Command-line usage

Transfer a single file from your filesystem

Here is what you type in your command line:

$ curl -u user:pass -T path/to/file chunk.io

Here is what you receive (as a text/uri-list payload):

http://chunk.io/crohr/f1ec04b3586f415d9ae4cac7bbe64826

Simple heh? From now on we’ll no longer separate request and response, and the username & password will be stored in the local .netrc file, i.e. the previous example will be written as:

$ curl -n -T path/to/file chunk.io
http://chunk.io/crohr/f1ec04b3586f415d9ae4cac7bbe64826

To silence the progression bar automatically added by cURL, just add the -s flag:

$ curl -nsT path/to/file chunk.io
http://chunk.io/crohr/f1ec04b3586f415d9ae4cac7bbe64826

Upload multiple files from your filesystem

$ curl -nsT "{path/to/file1,path/to/file2}" chunk.io
http://chunk.io/f/1edae590c82d46deb930b4237828d809
http://chunk.io/f/6f564528446f1572482f8462cf544d05

One URL per line. No worries. You can even do:

$ curl -nsT "img[1-1000].png" chunk.io
http://chunk.io/f/1edae590c82d46deb930b4237828d809
http://chunk.io/f/6f564528446f1572482f8462cf544d05
...

We also accept multipart uploads. In this case, if you send multiple files at once, they’ll be tar’ed up in a single .tar file! Here is how you would share multiple photos with your friends:

$ curl -n -FILE1=@path/to/file1.jpg -FILE2=@path/to/file2.jpg chunk.io
http://chunk.io/f/xxx

Then, you can either share the URL to the tar file, or access a single file within the archive:

$ curl http://chunk.io/f/xxx/file1.jpg

Pipe some content into chunk.io

$ cat file1 file2 | curl -nsT - chunk.io
http://chunk.io/f/1edae590c82d46deb930b4237828d809

Basically you can use this to upload the output of any tool that outputs something on STDOUT.

Yes, that means cURL as well:

$ curl http://www.iana.org/domains/example/ | curl -nsT - chunk.io
http://chunk.io/f/005310aba7fd6d1ef3ff0223ca166b9c

Delete files

Since Chunk.io now requires authentication, you can also remove any uploaded file:

$ curl -n -X DELETE http://chunk.io/crohr/f1ec04b3586f415d9ae4cac7bbe64826

Clipboard integration

If you’re on Mac OS, here’s how you send the content of your clipboard:

$ pbpaste | curl -nsT - chunk.io
http://chunk.io/f/1bb394a6596eb3a7b53ae2760c646b0d

And here’s how you copy the resulting link into your clipboard:

$ curl -nsT path/to/file chunk.io | pbcopy
$ pbpaste
http://chunk.io/f/1bb394a6596eb3a7b53ae2760c646b0d

See this article for an equivalent tool for Linux.

List uploaded files

$ curl -ns chunk.io/USERNAME
# last_modified=2017-08-16T14:07:15.000Z size=8296034
http://chunk.io/crohr/1a47cbda7c2d4f5cadbf5d2d0e65f1c3
# last_modified=2017-08-19T14:18:00.000Z size=395
http://chunk.io/crohr/3701eec6fd1b410c8ea1f77ec7115f36
...

Tips

# ~/.netrc
machine chunk.io
  login USERNAME
  password PASSWORD

Security

Chunk.io is also available over SSL (https://chunk.io). You should probably use that.

Be awesome

Syntax highlighting

Add the lang query parameter at the end of the URL to syntax highlight the file. For instance for a nodejs source file:

This works with all extensions supported by the Pygments library. You can also highlight specific lines of the file by putting a reference after the hash tag in the URL: http://chunk.io/crohr/45c179c7541c47cc922080f933b05857?lang=js#4-6.

For image files, just set the lang to png, jpg, etc. to get the image displayed in a proper HTML page: http://chunk.io/crohr/f1ec04b3586f415d9ae4cac7bbe64826?lang=jpg.

Tar archive preview

Remember the multi-file to .tar example? Try to append ?lang=tar or ?lang=archive you’ll get a nice page displaying the files in the archive! Works with gzipped tar archives too.

E.g. http://chunk.io/crohr/d53e0f60109145f9b97accb5c3c9c0b0?lang=tar.

Single file extraction from tar archive

Just append the name of the file you’d like to extract from the archive.

E.g. http://chunk.io/crohr/d53e0f60109145f9b97accb5c3c9c0b0/index.html.

Poor man’s static website hosting

See above: tar your static assets, upload to chunk, and access the index.html file!

Stream content (beta)

Ever wanted to share a log file with colleagues over HTTP? With real-time updates when new content appear? Then you should try the new streaming feature!

In a first terminal (producer), create a new stream, and send content to it

$ URL=$(curl -X POST stream.chunk.io/streams)
$ echo $URL # for reference
$ tail -f /var/log/nginx/access.log | curl -T - $URL

In another terminal (listener), access the URL and see live logs across the internet!

$ curl $URL

Terminating the producer will also terminate the connection on the listener(s).

Enjoy!

Is it free?

Yes, but due to abuse you need to manually ask for access. Uploads are limited to 200MB, and may be deleted after 6 months.

Want your own?

This is a simple NodeJS daemon, packaged as a DEB/RPM package or Docker image that can be easily installed on your servers. Contact hello@chunk.io if you’d like to buy a copy.

A OuestCode production - Humming along since 2010.