Delegate any Binary Data to files-Folder?

91 views
Skip to first unread message

Mirko Richter

unread,
Jun 19, 2020, 4:17:08 AM6/19/20
to TiddlyWiki
Hi!

Is there an automated way to "delegate" any binaries, that are dropped into the TW5-app in the browser, into the "files"-folder, replacing the tiddler inside of tw5 with externalized version (e.g. using _canonical_uri)?

Thanks!
Mirko

Saq Imtiaz

unread,
Jun 19, 2020, 4:54:30 AM6/19/20
to TiddlyWiki
Mirko: are you running TiddlyWiki on node.js or the single file version?

I have a plugin that does this on node.js (with some caveats).

Mirko Richter

unread,
Jun 23, 2020, 5:34:45 AM6/23/20
to TiddlyWiki
Hi Saq, i'm using node.js.

TW Tones

unread,
Jun 23, 2020, 8:34:25 AM6/23/20
to TiddlyWiki
Mirko

I was looking through the core plugins today and saw one that enables the dropping of images on tiddlydesktop and it just creates the external link to the image. Of course tiddlydesktop has file system access.

However I thought you could do the reverse, drop your images in the file folder and aquire them by browsing.

This may not suit your circumstances. Are you hoping to import images into the server from a remote connection? Like a drop box?

regards
Tony

Saq Imtiaz

unread,
Jun 23, 2020, 9:52:44 AM6/23/20
to TiddlyWiki
@Mirko : I worked on a plugin that does just that. I have a version that works, with some caveats. I plan to revisit and rewrite it when I can find the time.

If you want to give it a go, I have uploaded it at https://saqimtiaz.github.io/sq-tw/sandbox.html under the name "NodeJS import as External Files". Test with care, backup your wiki first.

Notes and caveats:
- it is possible for a file upload to the files folder to fail silently and you just end up with the canonical_uri tiddler. I've never experienced this and it isn't likely especially if using node.js locally, but it is possible due to the way the plugin hooks into the import process. This is the reason why I plan to redo this.
- the name of the file is the same as the tiddler name, so recommend not removing the file extension
- also there is no support yet for specifying a specific path (sub-directory) within the files folder.
- It assumes you are on node, so there will likely be issues if using it in a standalone tiddlywiki file.

Hope this helps,
Saq
Reply all
Reply to author
Forward
0 new messages