I'm a tad confused about how to add images to the TW - what I'm doing is
making a TW by programmatically (outside the TW and in another programming language :-) creating all the necessary tiddlers.
(I'm using the node TW implementation)
I have discovered by trial and error and the help of Mr Google that if I have an image
called `joe.jpg` it suffices to drop this into the `tiddlers` sub-directory.
Then I create a file called `joe.jpg.meta` containing the text
```
title: joe.jpg
type: image/jpeg
```
When I restart the node TW server the image is available - and can be translated into tiddlers with the syntax
`{{joe.jpg}}`
This trick seems to work with PDF and various non-text files.
The available options in the tools menu (import and `new image`) seem to do something different. I was wondering if:
# I've made the right files
# this is documented somewhere
Have I stumbled over an undocumented feature that might vanish in the future?
Another problem - once my TW is ready I want to publish the result as a single file TW so I use the command:
```
$ tiddlywiki <dir> --build index
```
And this makes a single file TW in `<dir>/output/index.html`
Once made, I'd like to unpack the TW and get back the individual tiddlers - so I tried this:
```
$ tiddlywiki --load ./share/output/index.html
--output ./tmp
--render "[!is[system]]"
"[encodeuricomponent[]addsuffix[.tid]]"
"text/plain"
"$:/core/templates/tid-tiddler"
```
Which unpacks the tiddlers into the directory "./tmp" - but now the image meta file
`joe.jpg.meta` and `joe.jpg` have vanished a new file `joe.jpg.tid` has appeared
which appears to contain the base64 encoded version of the image (I might be wrong here)
What I'd really like is to recover the original input.
I'd basically like two commands
```
pack <dir> <twname> and
unpack <twname> <dir>
```
That are exact inverses. Pack takes a directory of tiddlers and creates a single-file TW. Unpack takes a single-file TW and makes a directory of tiddlers *identical* to the original.
The reason for this is I want to write code like this
```
$ unpack <twname> <dir>
$ my own code in my funnt programming langauge that manipulates the stuff in <dir>
$ pack <dir> <twname>
```
I missed the advanced spells course at Hogwarts - so any advice on how to write `pack` and `unpack` would be welcome.
Cheers
/Joe