This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

WidgetMessage: tm-download-file

10th September 2026 at 1:49pm

The download file message causes the current saver module to prompt the user to download the result of parsing a specified template tiddler as a file. It requires the following properties on the event object:

NameDescription
paramTitle of a tiddler to use as a template for the new tiddler
{any other params}Any other parameters are made available as variables within the context of the widget message.

The following variable names have special behaviour:

NameDescription
filenameFilename for the downloaded file (note that this is a hint to the browser, and the actual filename used may be different)
typeNew in v5.3.7 Content type for the downloaded file

The download file message is usually generated with the ButtonWidget.

The download file message is handled by the TiddlyWiki core SyncMechanism which invokes the current SaverModule.

Examples

New in v5.5.0 you can use the template $:/core/templates/plain-text to create a custom download configuration without creating additional tiddlers:

\function field.value() [<pluginTitle>get{!!title}]

\function json.plugin()
	[<pluginTitle>fields[]]:reduce[<accumulator>jsonset{!!title},<field.value>]=>pluginData
	"[]"+[jsonset:json[0],<pluginData>]
\end

\define externalPlugin()
{
    const tw = globalThis.$tw ??= Object.create(null);
    tw.preloadTiddlers = (tw.preloadTiddlers ?? []).concat($(json.plugin)$);
}
\end


<$let pluginTitle="$:/plugins/tiddlywiki/menubar" text=<<externalPlugin>> >

<$button tooltip="Export standalone plugin">{{$:/core/images/export-button}} export <<pluginTitle>> as standalone plugin
<$action-sendmessage
  $message="tm-download-file"
  $param="$:/core/templates/plain-text"
  text=<<text>>
  filename={{{ [<pluginTitle>search-replace:g[/],[_]addsuffix[.js]] }}}
  type="text/javascript"
/>
</$button>

You can load the exported plugin by creating a tiddler with the tag <<.tag $:/tags/RawMarkupWikified/TopHead>> containing this:

```
`<script src="URL_OF_YOUR_PLUGIN_HERE" onerror="alert('Error: Cannot load YOUR_PLUGIN located at URL_OF_YOUR_PLUGIN_HERE');"></script>`
```

That renders as:

You can load the exported plugin by creating a tiddler with the tag $:/tags/RawMarkupWikified/TopHead containing this:

`<script src="URL_OF_YOUR_PLUGIN_HERE" onerror="alert('Error: Cannot load YOUR_PLUGIN located at URL_OF_YOUR_PLUGIN_HERE');"></script>`