Pastie Packer

Get Version


→ ‘pastiepacker’

Prepare to pack or unpack piles of files with pastiepacker. The easiest, best distributing, viewable archiving tool since pencil and paper.


A pastie is a snippet of text/code stored on a single webpage. This makes it very easy to share the text over IM or IRC - you just copy+paste the url. As a bonus, pasties are syntax highlighted making them easier to read than if shared as plain text.

The pastiepacker is a command-line tool to “pack” a selection of files (or by default, a whole recursive folder of files) into a single pastie. So a whole/part of a project can be quickly shared.

It can also “unpack” a packed pastie back into files. The pastiepacker is therefore a simple, useful distributed archiving tool, using pasties for storage.

For example, this pastie shows a selection of files packed into a pastie. It just happens to be the source for pastiepacker itself! (release 1.0.0)

You can pack a whole folder or a selection of files. Any README/readme. files are placed at the front of the pastie, because that seems helpful. The packed pasties include information on how to unpack the pastie back into raw files.

Only ascii files are packed.


sudo gem install pastiepacker

The basics: packing files into a pastie

To pack a folder: pastiepacker

Packing options:

-f, --format=FORMAT       Possess pasties with a particular persona
                          Supported formats:
                          c++, css, diff, html_rails, html, 
                          javascript, php, plain_text, python, 
                          ruby, ruby_on_rails, sql, shell-unix-generic
                          Default: ruby
-m, --message=MESSAGE     Promotional passage for your pastie
-p, --private             Posted pasties are private
                          Ignored for unpacking
-s, --stdout              Prints packed pasties instead of posting
-H, --no-header           Prevents placing pastiepacker promotion in pasties
                          That is, no 'about:' section is added to the top of pasties
-h, --help                Show this help message.                                     

To only pack a selection of files ending with txt you can pass a list of file names via STDIN:

  find * | grep "txt$" | pastiepacker

pastiepacker* outputs the url of the prepared pastie, so you can pipe it to xargs:

  pastiepacker | xargs open

If the selection of files (within the current folder or the selection of files via STDIN) contains a readme file (readme.txt, README.txt, README.markdown, etc), that file will be packed at the top of the pastie, for the convenience of readers.

The basics: unpacking pasties into files

To unpack a packed pastie:


This unpacks the files into a subfolder 175138/

To unpack a private pastie:


This unpacks the files into a subfolder 5hwfheniddqmyasmfcxaw/


How to submit patches

Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.

The source for the Pastie Packer is available via git.

git clone git:// pastiepacker
cd pastiepacker
rake install_gem

It is also available via

git clone git://
cd pastiepacker
rake install_gem

Or, you can unpack the 1.0.0 release of the pastiepacker from its own pastie!


This code is free to use under the terms of the MIT license.


Comments are welcome. Send an email to Dr Nic Williams via the forum

Dr Nic Williams, 25th June 2008
Theme extended from Paul Battley