Retrieving a Binary File imported as a tiddler in tw5?

269 views
Skip to first unread message

leeand00

unread,
Jul 6, 2018, 3:33:47 AM7/6/18
to TiddlyWikiDev
I imported a file into my Tiddlywiki 5, and it reads "This Tiddler Contains Binary Content" when I open it up.  Is there a way to retrieve the file?

leeand00

unread,
Jul 6, 2018, 3:34:29 AM7/6/18
to TiddlyWikiDev
I thought it was maybe encoded with base64 but when I tried to convert it, it did not result in my file being recreated.

TonyM

unread,
Jul 6, 2018, 4:27:26 AM7/6/18
to TiddlyWikiDev
Leeand,

What if you export it, edit it and remove the tiddler info and rename it to the correct extension (if you know it) ?

Of course very carefully.

Regards
Tony

Jeremy Ruston

unread,
Jul 8, 2018, 11:46:05 AM7/8/18
to tiddly...@googlegroups.com
I imported a file into my Tiddlywiki 5, and it reads "This Tiddler Contains Binary Content" when I open it up.  Is there a way to retrieve the file?

There's no way to retrieve the file at the moment, but it's one of those things I've been meaning to do for a long time, as it certainly would be useful, and is perfectly possible (as you surmise, the text field for binary tiddlers is the base64 encoded content of the file).

Best wishes

Jeremy

--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/a7c1cd29-8eff-4ad8-a867-bb041e55d6e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jed Carty

unread,
Jul 13, 2018, 8:25:48 AM7/13/18
to TiddlyWikiDev
This fits with some work I have been doing so I will just throw together a quick plugin to test it out. I think that the best way to implement it would be to create an action widget and then add a 'download as file' option to tiddlers that have base64 encoded contents. Would that work for your purposes?

Jed Carty

unread,
Jul 13, 2018, 2:06:38 PM7/13/18
to TiddlyWikiDev
I made an action-widget to do this. The code is on GitHub here: https://github.com/OokTech/TW5-DownloadBinary and a quick demo is here: https://www.ooktech.xyz:8443/Public#Download%20Binary%20Demo

If this looks like a good way to solve the problem I can make a pull request.

TonyM

unread,
Jul 13, 2018, 10:30:33 PM7/13/18
to TiddlyWikiDev
Jed,

Nicely done. Could this be generalised or branched to download as a file any tiddler as a file encoded or otherwise?

I understand to do this you are effectively decoding and exporting the content of a tiddler into a file (without tid or json info), returning the file to its native state.

What about (not even decoding) and exporting the content of a tiddler into a file (without tid or json info), returning the file to its native state (including the file extension specified) eg script and command files. I imagine PDF's as well.
 
The reason I ask is tiddlywiki could be a nice way to deliver a package of software including scripts and small executables wrapped in a website. 

I am trying to do this in my own way but this would be helpful, especially If a Could export a list of tiddlers as individual files in one hit, or even deliver a zip or executable zip.

Regards
Tony

Jed Carty

unread,
Jul 14, 2018, 5:40:57 AM7/14/18
to TiddlyWikiDev
You can already export tiddlers as plain text (rendered or not) to get things like .cpp files or script files out of them using the exporter. For a contract I did a while ago I made a wiki that would automatically generate code and there were buttons to export the generated files so people could make changes without having to know how to code. I have a similar wiki now that documents and generates some components for robbie. Once I finish testing I am probably going to make it public.

The widget can export any type of file that is registered by the core to be encoded in base64 when imported into a tiddlywiki. The list of files registered this way is ['image/gif', 'image/x-icon', 'image/jpeg', 'image/jpeg', 'image/png', 'image/svg+xml', 'application/pdf', 'application/zip', 'application/font-woff', 'application/x-font-ttf', 'audio/ogg', 'video/mp4', 'audio/mp3', 'audio/mp4'].

I have only tested exporting images so far.

You could make a button that exports a tiddler using the existing export mechanism. Or you could have it export a list of them, but you would be prompted to download them one at a time. You could probably make something using the jszip plugin to download a zip file that contains everything to get a single download. But that isn't really part of the downloadBinary widget.

TonyM

unread,
Jul 14, 2018, 9:45:48 AM7/14/18
to TiddlyWikiDev
Thanks Jed,

I was happy to use text/plain but every file I tried to export as say name.bat ended up being name.bat.html from firefox, I then took along journey to see if I could register other mime types (which I has abandoned)

I will try again, and hope I do not get lost in the links and transcludes again.

Best Wishes
Tony

Jed Carty

unread,
Jul 14, 2018, 11:10:44 AM7/14/18
to TiddlyWikiDev

TonyM

unread,
Jul 14, 2018, 10:38:33 PM7/14/18
to TiddlyWikiDev
Thanks Jed.

TonyM

unread,
Jul 14, 2018, 11:03:03 PM7/14/18
to TiddlyWikiDev
Jed,

I used your demo-site and created exactly what I want according to your instructions. Fantastic.

I use google Chrome with a chrome user to use google groups.

I went to my firefox and the aforementioned problem of always adding a .html extension returned, the same for the ESR version (52?)

Do you or anyone know how to stop this in FireFox, my preferred browser?

Thanks
Tony


On Sunday, July 15, 2018 at 1:10:44 AM UTC+10, Jed Carty wrote:

Jed Carty

unread,
Jul 15, 2018, 5:38:07 AM7/15/18
to TiddlyWikiDev
When I do it in firefox on osx or linux it says something like 'would you like to download this html document?' when downloading but it doesn't add the .html to the end of it. I think that there is probably some setting either in windows or firefox that automatically appends the extension. The last time I worked in windows (it was windows 7) there was some option that I had to find before it let me set the file extensions on any files. Maybe that is the problem.

TonyM

unread,
Jul 15, 2018, 8:40:17 PM7/15/18
to TiddlyWikiDev
Jed,

Thanks for the tip, I will investigate. I have a few loose ends to address like that. Having spent the last year or two doing intensive self education in tiddlywiki and associated tech I have being hacking everything I see new opportunities with. Somehow I even have a persistent cursor on webpages, when I am not in text fields. But with your help and others I feel I can finally start contributing back to the community at a higher level.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages