created: 20130825150000000
modified: 20210714130751701
tags: [[TiddlyWiki on Node.js]]
title: TiddlerFiles
type: text/vnd.tiddlywiki
Tiddlers can be stored in text files in several different formats. Files containing single tiddlers can also have an auxiliary `.meta` file formatted as a sequence of name:value pairs:
```
title: TheTitle
modifier: someone
```
!! ~TiddlyWeb-style .tid files
These files consist of a sequence of lines containing name:value pairs, a blank line and then the text of the tiddler. For example:
```
title: MyTiddler
modifier: Jeremy
This is the text of my tiddler.
```
Note that many text editors require that files include a terminating newline. If you want to avoid including the terminating newline in the text of the tiddler you can use this alternative syntax:
```
title: MyTiddler
modifier: Jeremy
text: This is the text of my tiddler.
```
//The ContentType `application/x-tiddler` is used internally for these files//
!! TiddlyWiki `
` .tiddler files
In TiddlyWiki 5, `*.tiddler` files look like this:
```
Note that there is an embedded tag, and line feeds are not escaped.
And, weirdly, there is no HTML encoding of the body.
```
These `*.tiddler` files are not exactly the same as the tiddlers inside a TiddlyWiki HTML file where they are HTML encoded.
Older `*.tiddler` files more closely matched the store format used by TiddlyWiki at the time:
```
This is an old-school .tiddler file, without an embedded <pre> tag.\nNote how the body is "HTML encoded" and new lines are escaped to \\n
```
//The ContentType `application/x-tiddler-html-div` is used internally for these files//
!! ~TiddlyWeb-style JSON files
These files are a straightforward array of hashmaps of `name:value` properties. All field values must be specified as strings.
For example:
```
[
{
"title": "First Tiddler",
"text": "Text of first tiddler",
"tags": "one two [[t h r e e]]"
},{
"title": "Second Tiddler",
"text": "Text of second tiddler",
"modified": "20150216171751154"
}
]
```
The ContentType `application/json` is used internally for these files.
Note that JSON files that do not conform to the tiddler structure will instead be imported as a single tiddler containing the JSON data.
!! New JSON-based format for TiddlyWiki HTML files
The new format for TiddlyWiki HTML files embeds the tiddlers in JSON format within a script tag:
```json
```
!! Old DIV-based format for TiddlyWiki HTML files
TiddlyWiki Classic and TiddlyWiki 5 prior to version v5.2.0 stored tiddlers encoded in `
` format.
For TiddlyWiki to import an unencrypted DIV-based HTML file, it requires a `
` containing tiddler DIVs as explained above. For example:
```
HTML encoded text of tiddler
```