Can you create a text file from TiddlyWiki on node.js?

164 views
Skip to first unread message

si

unread,
Jan 2, 2021, 11:40:52 AM1/2/21
to TiddlyWiki
As I understand it, TW single file version cannot do anything with the file system on your computer while running in a browser.

Does this restriction disappear when using node.js? For example, could I (theoretically) create a button in my wiki that creates a new text file somewhere on my system, which is then opened automatically in a text editor?

It seems from my limited use that the node.js version of TW will create individual tiddler files on your desktop as you create new tiddlers in the wiki, so presumably it is able to interact with the file system in some way?

I don't know anything about this topic so I am aware this is probably a very nooby question!

Mark S.

unread,
Jan 2, 2021, 1:43:57 PM1/2/21
to TiddlyWiki
You might check out Bob, a version of TW on node that allows you to run scripts on the local server.

si

unread,
Jan 3, 2021, 8:52:10 AM1/3/21
to TiddlyWiki
Great thanks Mark. I have seen people discuss Bob but never really knew what it was. I will check it out.

TW Tones

unread,
Jan 6, 2021, 12:55:11 AM1/6/21
to TiddlyWiki
Si,

As a new comer try the Bobexe implementation. 

However TiddlyDesktop, hta and(limited) and TWExe solutions do have more access to the local system. However what do you actually want to do or use these  text files for?, creating, editing, reading, importing, generating etc...

I have other ideas and solutions to share.

Tones

Joshua Fontany

unread,
Jan 10, 2021, 3:10:10 AM1/10/21
to TiddlyWiki
This is exactly what TW5 on Node.js does. When you create a new tiddler in draft-mode, a file named "Draft of 'Tiddler 1' by Username.tid" is saved to the file system. If you change the Type field to "text/plain", then a new set of files is created, first  "Draft of 'Tiddler 1' by Username.txt", which holds the contents of he main "text field" shown in the browser's edit-template, and second a file named  "Draft of 'Tiddler 1' by Username.txt.meta"  which holds all other fields liek Title, Tags, etc, etc, etc.

Best,
Joshua Fontany

On Saturday, January 2, 2021 at 8:40:52 AM UTC-8 si wrote:

si

unread,
Jan 12, 2021, 3:47:22 PM1/12/21
to TiddlyWiki
Hi Tones,

Sorry I did not see that you had replied until just now.

I had seen that Larry Sanger had created a kind of spaced repetition tool for practising programming tasks. In short it displays a short programming puzzle, then will automatically create a file and open it up in a text editor for you to complete the task. When you're done you can run it and it will confirm that you go the correct output. It can then be rescheduled so that you will see it again at some point in the future. It saves a new file for every time that you complete a task, so you can look at any of your previous answers.

Anyway I was just wondering to myself how much of this could be recreated in TiddlyWiki, and the first thing that you would need to be able to do is create a file for whatever language you are using, and open it in your text editor. It would also be good to be able to easily view the older versions of a task from within TiddlyWiki.

I'm not actually planning to make something like this right now, it's more of a 'possible future project'. I was just curious as to whether or not it would even be possible. I'm certainly interested in any thoughts, ideas, or other solutions that you have.

Si

Michael Wiktowy

unread,
Jan 12, 2021, 10:20:12 PM1/12/21
to TiddlyWiki
Si,

I don't know if this is too limited of a solution for you but it is pretty simple. If you have your text data in a tiddler, you can just use tm-download-file message to create a text file using the browser download functionality (with all the limits that imposes).

I made a macro quite recently to do a similar thing and it works well.

\define downloadButton(tiddler:"")
<$button>Download $tiddler$
<$action-sendmessage $message="tm-download-file" $param="$tiddler$" filename="$tiddler$"/>
</$button>
\end

<<downloadButton "Text Tiddler Name">>

/Mike
Reply all
Reply to author
Forward
0 new messages