Before now programs disappeared if you didn’t manually copy them into a text file before closing the browser. Now, however, there are buttons to let you save and load Poki Nanpa files into a bespoke file format called .poki.

Not only does this save the program, it also saves the state of the canvas. So if you’re sharing a program with someone, you can put stuff in the canvas and they’ll be able to see it when they load up the program.
To save the canvas I used simple run-length encoding. The canvas isn’t that huge, so this is a perfectly sufficient form of compression. A .poki file also saves the position of the cursor. Handling the files in JavaScript was a little fiddly but I found this StackOverflow answer that did exactly what I wanted by creating a dummy download link to load the data into.
Loading is just all the same steps in reverse. Now I can start creating example programs in a consistent format that the user can load directly rather than needing to copy-paste the actual text.