20 file formats, every one generated at an exact size
Each of these is a real file of that format. It opens in the software that owns it, and it is exactly the number of bytes you asked for. None of them is padded zeros with an extension bolted on.
| Format | Extension | Smallest file | Fidelity | Checked against |
|---|---|---|---|---|
bmp |
.bmp |
58 | full | pillow |
csv |
.csv |
117 | full | python-csv |
docx |
.docx |
1227 | full | libreoffice |
gif |
.gif |
41 | full | pillow |
html |
.html |
118 | full | python-html |
ico |
.ico |
70 | full | pillow |
jpg |
.jpg |
602 | full | pillow |
json |
.json |
219 | full | node-json |
log |
.log |
155 | full | not applicable |
md |
.md |
0 | full | not applicable |
pdf |
.pdf |
3415 | full | pdftotext |
png |
.png |
73 | full | pillow |
pptx |
.pptx |
4826 | full | libreoffice |
svg |
.svg |
194 | full | inkscape |
targz |
.tar.gz |
9793 | full | 7z |
txt |
.txt |
0 | full | not applicable |
wav |
.wav |
98 | full | ffprobe |
xlsx |
.xlsx |
1735 | full | libreoffice |
xml |
.xml |
264 | full | python-xml |
zip |
.zip |
8382 | full | 7z |
What the columns mean
-
Smallest file
The fewest bytes this tool will accept for that format, including the label it writes inside the file. Ask for less and you get an error naming the floor and the reason for it, never a file of the wrong size.
-
Fidelity
How complete the file is.
fullmeans a reader that really parses the format accepts it, not merely that the extension matches. -
Checked against
The independent reader that opens every generated file before the format ships - a separate implementation, not our own code marking its own homework.
Every format also repeats to the byte: the same recipe and seed produce identical files on any machine, which is what makes a recipe safe to commit in place of the fixtures themselves.
Settings each format accepts
Most formats take settings of their own - image dimensions, JPEG quality, PDF page count, rows and
columns in a spreadsheet, how many entries go inside an archive. Set them with
--set key=value on the command line, or under properties: in a recipe.
tfg generate --format jpg --size 500kb --set width=1920 --set height=1080 --set quality=85
| Format | Setting | Accepts |
|---|---|---|
bmp |
width |
1 - 20000 pixels |
height |
1 - 20000 pixels | |
docx |
paragraphs |
1 - 50000 paragraphs |
gif |
width |
1 - 20000 pixels |
height |
1 - 20000 pixels | |
ico |
width |
1 - 256 pixels |
height |
1 - 256 pixels | |
embed |
bmp, png | |
jpg |
width |
1 - 20000 pixels |
height |
1 - 20000 pixels | |
quality |
1 - 100 | |
pdf |
pages |
1 - 5000 |
page_size |
a3, a4, a5, legal, letter | |
png |
width |
1 - 20000 pixels |
height |
1 - 20000 pixels | |
pptx |
slides |
1 - 500 slides |
targz |
entries |
0 - 10000 |
entry_format |
text | |
entry_size |
a size such as 2mb | |
wav |
sample_rate |
8000 - 192000 hertz |
bit_depth |
8, 16, 24, 32 | |
channels |
1 - 8 | |
content |
noise, silence, sweep, tone | |
xlsx |
rows |
1 - 200000 rows |
columns |
1 - 64 columns | |
zip |
entries |
0 - 10000 |
entry_format |
text | |
entry_size |
a size such as 2mb |
A value outside what a setting accepts is refused with a message naming the setting, the allowed range and what to use instead. An unknown setting is an error too, never a silent default - a typo accepted in silence gives a file with the wrong settings and an hour spent wondering why the test passes when it should not.
Run tfg formats <id> to see exactly what one format accepts on the build you have.
Archives hold real files
targz and zip
can be filled with entries rather than left as an empty shell. A generated archive genuinely
contains the documents it claims to contain, so anything that unpacks it during a test finds real
files inside.
targets:
- id: bundle
format: zip
contains:
- format: txt
count: 200
size: 4kb
Formats that are not here yet
7z, tiff, webp, mp3 and mp4 are
planned and not built. They are absent from the list above rather than present and half working,
and asking for one is an error saying the format is unknown.
If you need one of them, or a format that is not on either list, the issue tracker is where that gets decided.