Unexpected action when using --savewikifolder

I have this idea that I could use node.js and standalone interchangeably by converting back and forth between forms.

To convert a standalone TW I used the --savewikifolder command. I was surprised/worried how slow the resulting node.js version worked.

When I saved back to the standalone, I was even more surprised that my wiki file size had increased 10 fold!

So, it turns out that when you use --savewikifolder, it automatically imports as embeded tiddlers everything in your external files directory. It does not do any mapping to your existing _canonical_uri tiddlers.

I guess my main comment is that this is not documented, and somewhat unexpected. To make it useful, you would have to spend a great deal of time remapping your existing links to the new tiddlers. But if you’re converting back and forth, this would not be practical.

Now that I know it is happening, I can just delete the tiddlers to prevent bloating. It seems like it would be better if there was a switch to turn off this behaviour, but maybe not enough of us use this command to matter.

Could you expand on that a little? I assume that your HTML file has _canonical_uri tiddlers that point into your files directory? And the behaviour you are seeing is that the binary image files from that folder are being imported and turned into tiddlers?

Looking at the code for the savewikifolder command, it doesn’t perform any special processing with _canonical_uri tiddlers, and I can’t see a mechanism that would import the files that they point to.

How does your directory structure look like?

If your binary files are part of the tiddlers folder, they will be imported into the single file wiki.

Some of them do. The biggest one just has a tiddler with an external [ext[]] link.

ALL of the files in the files/ directory are converted into binary tiddlers. Even those without _canonical_uri tiddlers.

That’s the wrong direction. I’m talking about making a single-file wiki into a node.js instance.

My /files sub-directory has 13 image and pdf files. I run

WikiFarm$ tiddlywiki --load ~/data/Wikis/notes-2020 --savewikifolder ./notes-2020x

The resulting node.js instance now has 13 new binary tiddlers in the tiddlers directory. All of them are titled starting with the complete path name to the original tiddler.

One thing I’m wondering, is if there could be some unexpected interaction with the external attachments plugin. That’s the only plugin in the collection that might work with external files

Hi @Mark_S this is most mysterious.

I think you are saying that you have a single file wiki that includes an [ext[]] link to a resource in the files directory alongside wiki, and that in the process of running savewikifolder the actual content of the resource is imported as a tiddler.

I just don’t see how the savewikifolder command can be accessing the files folder at all. It just deals with the contents of a single HTML file, and doesn’t perform any other file access.

Are there any plugins involved? It might be helpful to see the complete command line that is being used.

I also have this question, why are you using folders instead of explicitly specific HTML files for the savewikifolder command

Where is your /files directory ? – I did have a similar problem lately. Everytime I did edit and save an image.png which contained an _canonical_uri the tiddler was messed up. That’s why I did ask, how your directory structure looks like.

Actually, that is the right question, but for the --load command. The --savewikifolder command wants just a path.

So apparently if you give --load a directory, everything in that directory becomes a tiddler, including images. The text for --load says

Load tiddlers from TiddlyWiki (.html ), .tiddler , .tid , .json or other local files.

The part I didn’t catch was “other local files”, which apparently includes images.

So, I just need to specify exactly what I want to load.

I’m not sure if it’s relevant at this point (see prior post about --load), but my files/ directory was in the same directory as the TW file I wished to import.

.
├── files/
└── notes2020.html