cold-widow
Executables and Haskell library to transfer files via QR Codes.
The idea is to generate a list of qr-coedes representing the archived
version folder. The qr-codes will be read as text values by any qr-code
reader supporting alpahnumeric encoding. The texts can be send via any
technology, like email, sms, whatsapp, skype, hangouts, etc to the final
destination. At the final destination, you feed these texts to the decoder
and get the original file structure.
Installation
The only supported installation method is from source files,
stack.
Building from source
Prerequisites
You will need to download and install stack.
You also need git to get the latest source code.
Get the source
git clone https://github.com/mihaigiurgeanu/cold-widow.git
Building
To build the project, you need first to run stack setup
. This command
will make sure you have the correct haskell compiler, and, if you don't
have it, it will download and install one in a separate location in such
a way to not interract with your existing haskell environment (if you have one):
#> cd /the/location/of/cold-widow/
#> stack setup
After the setup (you only need to run setup once) you may build, test or install
the software. To build, simply issue:
#> stack build
To run the tests:
#> stack test
To install it in the stack's install directory, type:
#> stack install
Usage
The only functions implemented until now are encoding and decoding a file to/from
a textual form using only the alphanumeric symbols allowed in a QR Code. This will
allow you to read the generated QR Code with any QR Code reader, copy paste the
text in an email or whatever transport you choose.
To generate QR Codes you need to use external programs to archive and compress
your files, to split the archive in appropriate size to be encoded in the QR Codes.
For example:
#> tar cv informic-0.1.0/*.patch | bzip2 -9 | split -b 2900 - informic-0.1.0/x
will archive the files with the extension .patch
located in the informic-0.1.0/
folder, will compress the archive using bzpi2
utility, will split the resulting
compressed archived in files named xaa
, xab
, xac
, etc. of 2900 bytes each
and will put these files into informic-0.1.0/
folder.
To encode those files using cold-widow's encode45 you could use the following:
#> cd informic-0.1.0
#> for i in x*; do encode45 $i > $i.txt; done
Then you should use a qr-code generator to generate one qr-code for each
xaa.txt
, xab.txt
, xac.txt
, etc files generated by the above commands. Scan
the qr-codes with you mobile phone and copy-paste the text into a email message
that you can send to anyone you want.
Finally, using decode45
you can convert the fragments of text back to the original
archive. Copy in the clipboard the text coresponding to first part (the file xaa
in the example above) and paste it in a file, for example in the xaa.txt
file:
#> decode45 xaa < xaa.txt
This will generate on disk the file named xaa
with the same contents of the
original xaa
file which is a part of the splited compressed archive. After
doing this for all file parts, you can use the following to obtain the original
files structure:
#> cat x* | bzcat | tar xv
encode45
The encode45
utility will get a file as first argument and will output
the encoded text representing the file. The text will contain only characters
allowed by the qr-code alphanumeric mode.
To use it as a qr-code, you need to pass a maximum of about 2900 bytes file to
the encode45
utility.
decode45
decode45
will read from standard output a text containing only the characters
allowed in qr-code alphanumeric mode and will decoded as a binary file. The name
of the file to which decode45
will save the binary data must be passed as
the first argument of the decode45
method.