Can your own web pages at home!

pickles, originally uploaded by valkyrieh116.

Want to bundle a web page into a single file, without a _files directory, or using the not-supported-everywhere .mht (IE, Opera) or .webarchive (Safari) formats? Use pagecan! I developed pagecan so I can return converted documents on as a single file.

pagecan will take an URL of an HTML document, grab all resources referenced by “src”, and bundle the page and encoded resources into a single file, through the use of the data URI scheme. pagecan is written in Ruby and uses the Nokogiri parser (you can install the gem with gem install nokogiri, or the Debian package with sudo apt-get install libnokogiri-ruby).

Usage: pagecan url [file | -]

If ‘-’ or no file is given, output is sent to stdout. pagecan has been tested only with HTTP URLs, but as it uses Ruby open-uri, other URIs and local files may work.

pagecan on github

This entry was posted in Code. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>