TIL how Tuesday JS packs Zip files

Sunder Iyer - Feb 4 '21 - - Dev Community

2021-02-03

A friend linked me to a JS visual novel engine called Tuesday JS and it's kinda blown me away, a little. So the actual engine itself is interesting as it contains many features you'd want in a visual novel such as dialog choices and localization. And it relies on no other libraries so I guess it's what you cool kids call vanilla JS. But what really got me curious was the visual editor.
Tuesday JS visual editor with scene and dialog ui elements
It's a single HTML file. Your story/game data is stored as JSON which the editor can create or load. This data is represented on screen with UI elements that you can use to further manipulate the game data. Once you're done, you can export it.
Tuesday JS Visual Editor with export dialog
Wait a second, a zip file? How's this possible, I asked myself. It's a FOSS project so I took a peek and within the editor code, JSZip is embedded. Its API is super simple and is used in the function called build_zip to pack the project files into a zip file.
All this is fascinating to me because web-based game tools have a lot of potential. Games such as CrossCode are built off web tech but when I played it on Xbox, I experienced a snappy action game which I won't have known was built off ImpactJS.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .