[TWC] Local files with TiddlyDesktop or TiddlyServer?

238 views
Skip to first unread message

Jon

unread,
Jan 12, 2018, 6:08:18 PM1/12/18
to TiddlyWiki
Hi,

I have some highly modified TWCs that are important but way too much trouble to convert to TW5 (until maybe retirement puts a lot of time into my hands).

It would be very useful for a couple of these to be able to read and write local files. Impossible with current browsers, but perhaps possible with TiddlyDesktop or TiddlyServer? If so, can someone spoon-feed me some basics to help me get started? I'm experienced with TW, but not at all experienced with nodejs or nw. The files could be either ordinary text files or externally stored tiddlers, it doesn't really matter, as long as I can read and write them with javascript.

Thanks!
Jon

Mark S.

unread,
Jan 12, 2018, 6:33:44 PM1/12/18
to TiddlyWiki
What do you mean by "local files... impossible with current browsers" ? Have you seen https://pmario.github.io/file-backups/ ?

-- Mark

TonyM

unread,
Jan 12, 2018, 7:51:13 PM1/12/18
to TiddlyWiki
Jon,

I am using TiddlyDesktop now for my large TWC. I was using firefox and also TW5 for what I call desktop intergration, a rich interaction with my windows 10 file system, but I have put this on hold with the Browser clamp downs. 
I do not need to read/write via Javascript, perhaps this is a question for the TiddlyWikiDev forum but Mark S. and other can help here.

Once something is a tiddler of course you have more control, so the import, export tools and the code behind them should help.

Regards
Tony

Rehards
Tony

okido

unread,
Jan 13, 2018, 6:29:14 AM1/13/18
to TiddlyWiki
Hi Jon,

Reading local text files is possible, I use d3.js and some inline JavaScript in FF57.
Download the d3.js from github, past it in a tiddler and tag with systemConfig.
Paste the following inline js in a tiddler and provide the right path/filename and tiddlername to save. InlineJavascriptPlugin is required.

<script>
  d3.text("path/filename.txt", function(data) {
  store.saveTiddler("LoadedDataD3", "LoadedDataD3", data, config.options.txtUserName, new Date(), "tags")
  })
</script>

There you go.

Have a nice day, Okido

Op zaterdag 13 januari 2018 00:08:18 UTC+1 schreef Jon:

Jon

unread,
Jan 13, 2018, 4:53:16 PM1/13/18
to TiddlyWiki

What do you mean by "local files... impossible with current browsers" ? Have you seen https://pmario.github.io/file-backups/ ?

Sorry, maybe not clear. Not worried at the moment about saving the TW (Waterfox + TiddlyFox still works) - looking to be able to have a macro write a data file to disk.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

okido

unread,
Jan 14, 2018, 7:54:03 AM1/14/18
to TiddlyWiki
Hello Jon,

You can use filesaver.js, see on github, https://github.com/eligrey/FileSaver.js/
The plugin for Tiddlywiki Classic is attached.
An example to use with InlineJavascript is included.
For your macro request please let me know what tiddler parts you want to save.

Posting the file on this forum gives an error at the moment, I will try later.


Have a nice day, Okido


Op zaterdag 13 januari 2018 00:08:18 UTC+1 schreef Jon:
Hi,

TonyM

unread,
Jan 14, 2018, 8:13:19 AM1/14/18
to TiddlyWiki
Jon

Investigate writing your own exporter using the one already there. I think tiddlywiki.com will lead you there or search this forum.

So far I can only save as registered file types but you may be able to overwrite existing files. Unless you use a file save dialogue with appropriate browser setting you will most likely be restricted to the download directory.

See how you go, I can give more info.

Regards
Tony

Jon

unread,
Jan 15, 2018, 4:34:59 PM1/15/18
to TiddlyWiki

Thank you, Tony & Okido. Those are both good leads!

Duh, should've thought about starting from the built-in saving mechanism. But, Okido, if you have a TWC plugin for filesaver.js already, that would certainly save me time.

Thanks,
Jon

okido

unread,
Feb 4, 2018, 1:14:38 PM2/4/18
to TiddlyWiki
Hello Jon,

Somebody made a comment to use the internal download mechanism.
You can do this with some inline javascript, InlineJavascriptPlugin is needed:

<script>
let fileName = "data.txt"
let dataContent = "Lorum ipsum"
HTML5DownloadSaveFile(fileName, dataContent)
</script>

You are restricted to the download directory, but further every thing goes.


Have a nice day, Okido



Op maandag 15 januari 2018 22:34:59 UTC+1 schreef Jon:

Robert Edwards

unread,
Feb 4, 2018, 2:20:37 PM2/4/18
to TiddlyWiki

Jon

unread,
Feb 7, 2018, 12:02:01 PM2/7/18
to TiddlyWiki
Okido, that's an absurdly simple and effective solution that, delightfully, also works fine without TiddlyDesktop or TiddlyServer. Subdirectories work, so I have no problem with being restricted to the download directory.
Robert, thank you for that helpful link! I didn't know about either MicroTiddlyServer or that a Classic group had formed. Very useful on both counts.
Reply all
Reply to author
Forward
0 new messages