How do I access an embedded binary file?

139 views
Skip to first unread message

Michael Borgwardt

unread,
Oct 29, 2019, 4:13:34 AM10/29/19
to TiddlyWiki

I'm running TW on node.js, so storing binary files directly in Tiddlers is unproblematic - they just get uploaded and stored as separate files.


However, if I embed e.g. a Powerpoint file, how can I actually access it? I'm looking for a way to include a download link to the file in the text of another Tiddler. But I can't find out how to do that. If I use a normal link to the file's Tiddler, that just opens.

Now according to https://tiddlywiki.com/#How%20to%20embed%20PDF%20and%20other%20documents at least "When you edit the tiddler a link is presented. You can right click on the link in order to download the file. " - but I cannot find that link either. There is just a yellow box saying "This tiddler contains binary data".

PMario

unread,
Oct 29, 2019, 6:41:44 AM10/29/19
to TiddlyWiki

Michael Borgwardt

unread,
Oct 29, 2019, 6:51:26 AM10/29/19
to TiddlyWiki
Thanks, but I don't think that does what I need, because it only serves files from a "files" subfolder which you have to put there manually. But I want to use TW's own uploading facility, which puts the files in a "tiddlers" subfolder.

A Gloom

unread,
Oct 29, 2019, 7:25:31 AM10/29/19
to TiddlyWiki
Now according to https://tiddlywiki.com/#How%20to%20embed%20PDF%20and%20other%20documents at least "When you edit the tiddler a link is presented. You can right click on the link in order to download the file. " - but I cannot find that link either. There is just a yellow box saying "This tiddler contains binary data".

Not an answer but I did as you did following the canonical url method describe at the official TW site...

loading a file format that TW/brower didn't recognize I got this in view mode of the tiddler

Clipboardzz1.jpg


but opening up the tiddler in edit mode, i found the link (yellow colored) that had a right menu option to "save link as" which saved the xcf file to HD

Clipboardzz2.jpg



Michael Borgwardt

unread,
Oct 29, 2019, 9:19:38 AM10/29/19
to TiddlyWiki

Not an answer but I did as you did following the canonical url method describe at the official TW site...

Oh, now that you forced me to look again, harder, I see that it says "If your browser and/or TW5 doesn't know what to do with a particular file format, then you can only the use the second method to embed and then download a file." - so I'm not overlooking anything, this is just a capability that TW does not have. I guess I'll have to wrok around it.

A Gloom

unread,
Oct 29, 2019, 6:31:44 PM10/29/19
to TiddlyWiki
Michael

no need for embedding of canonical url

first you must say the words...


Klaatu... verata... n-*mumble*


then type your url or local path into a tiddler's text body/field (or a custom field to read) ie: file:///C:/Unit%202%20PPT%20Scientific%20Notation-2.ppt

close the tiddler, the link that appears, when clicked on (in Firefox at least) automatically generates a download/save window

Michael Borgwardt

unread,
Oct 30, 2019, 4:55:14 AM10/30/19
to TiddlyWiki


Am Dienstag, 29. Oktober 2019 23:31:44 UTC+1 schrieb A Gloom:
then type your url or local path into a tiddler's text body/field (or a custom field to read) ie: file:///C:/Unit%202%20PPT%20Scientific%20Notation-2.ppt

But I don't *have* an URL or local path, that's the problem. The files get uploaded to the server, but in a folder that the node.js server does not make accessible through URLs or in any other way (as far as I can tell).

A Gloom

unread,
Oct 30, 2019, 5:37:13 AM10/30/19
to TiddlyWiki
But I don't *have* an URL or local path, that's the problem. The files get uploaded to the server, but in a folder that the node.js server does not make accessible through URLs or in any other way (as far as I can tell).

I see your problem-- I tested with single file : (  Hopefully, someone familiar with node.js will know.  Maybe the instructions on the official wiki were for single file TW only.  I think I'll stick wirh sigle file if node.js makes access to external files difficult (half my wiki's content is external files)

PMario

unread,
Oct 30, 2019, 7:07:34 AM10/30/19
to TiddlyWiki
On Tuesday, October 29, 2019 at 9:13:34 AM UTC+1, Michael Borgwardt wrote:

I'm running TW on node.js, so storing binary files directly in Tiddlers is unproblematic - they just get uploaded and stored as separate files.


As you found out, it is problematic, since the tiddlers directory is meant to be used for stuff, that can be used directly by the TiddlyWiki app. A pptx file can _not_ be directly used as a tiddler. ... That's the reason, why you have problems.
 

However, if I embed e.g. a Powerpoint file, how can I actually access it?


If you want to use 3rd party files and expect the browser to do, what browsers do, you will need to store your ppt files in the files directory as advised in the docs.

Every file in the files directory will be accessible with [ext[./files/filename.ext]]. Depending on the extension and the browser, the browser will react in different ways.
 

I'm looking for a way to include a download link to the file in the text of another Tiddler. But I can't find out how to do that. If I use a normal link to the file's Tiddler, that just opens.


You can use a link like [ext[./files/yourFileName.pptx]] and the browser will open the link with a system dialogue, that asks what it should do.

The drag and drop IMPORT mechanism can only be used for tiddlers. If you want to serve binary data, it has to go into the files directory.

have fun!
mario

Greg Davis

unread,
Oct 30, 2019, 4:16:56 PM10/30/19
to tiddl...@googlegroups.com
I don't use node.js so I maybe misunderstanding what you are trying to do. If I understand, you are dragging a ppt file into TiddlyWiki so it becomes embedded as a tiddler. Then you want to download that embedded ppt file.

That sounds like the problem of downloading an embedded zip file. Such files are stored in the TiddlyWiki in a base encoded format. Jeremy gave an example of downloading such a file:

Embed a ZIP for download?
https://groups.google.com/forum/#!msg/TiddlyWiki/XoyXlWO8SpA/K_IcD4qgvhwJ

Not sure if this would work for ppt files or if a modification of boot.js similar to the one Jeremy mentioned for zip files would be needed for ppt files. Such a mod should be tested before using on your good TiddlyWiki.

To download zip files I made a macro (attached) based on what Jeremy suggested. I have not tested it intensively but seemed to work for zip, pdf, png, and gif files.

Hope that is helpful,
Greg
$___macro_jermolene_download.tid

Michael Borgwardt

unread,
Oct 31, 2019, 3:41:28 AM10/31/19
to TiddlyWiki


Am Mittwoch, 30. Oktober 2019 10:37:13 UTC+1 schrieb A Gloom:
I see your problem-- I tested with single file : (  Hopefully, someone familiar with node.js will know.  Maybe the instructions on the official wiki were for single file TW only.  I think I'll stick wirh sigle file if node.js makes access to external files difficult (half my wiki's content is external files)

The access to actually external files is no different, the node.js version just makes it in theory practical to *embed* lots of files into the wiki itself, and with images this works fine and is very convenient (you just drag and drop the image to the wiki page). I'm just trying to find a way to have the same convenience with non-image files.

Michael Borgwardt

unread,
Oct 31, 2019, 4:10:47 AM10/31/19
to TiddlyWiki

Am Mittwoch, 30. Oktober 2019 12:07:34 UTC+1 schrieb PMario:
As you found out, it is problematic, since the tiddlers directory is meant to be used for stuff, that can be used directly by the TiddlyWiki app. A pptx file can _not_ be directly used as a tiddler.

Except it _can_ - It is imported and shown as a tiddler, the only thing that is missing is a download link - and that is not hard to add, as Greg's answer shows. For images it already works with much more extensive support, and there is neither a technical nor really a conceptual difference to embedding other binary files.

If you want to use 3rd party files and expect the browser to do, what browsers do, you will need to store your ppt files in the files directory as advised in the docs.

Which is rather inconvenient, since I have to manually put the files there (not trivial for wiki run on a server) and manually enter the correct filename without search functionality.
 
The drag and drop IMPORT mechanism can only be used for tiddlers. If you want to serve binary data, it has to go into the files directory.

Not really - binary tiddlers already exist and work, the only thing missing is a download link feature.

Michael Borgwardt

unread,
Oct 31, 2019, 4:19:19 AM10/31/19
to TiddlyWiki


Am Mittwoch, 30. Oktober 2019 21:16:56 UTC+1 schrieb Greg Davis:
To download zip files I made a macro (attached) based on what Jeremy suggested. I have not tested it intensively but seemed to work for zip, pdf, png, and gif files.

THANK YOU! Looks like that's pretty much exactly what I need. A short test seems to indicate that there's still a problem - the downloaded file is empty. But I hope that's fixable if I look more closely at the discussion you linked.

Cheers,
Michael
Reply all
Reply to author
Forward
0 new messages