Is this possible? Let's say I have some site JS that retrieves some data (ex. using api.php). Is there a way to save this data as a file to the local machine? I have tried searching online and it doesn't look like it is possible without additional libraries. Yes, there are data URIs but most places I looked said those aren't a good idea for large sets of data.
An unrelated but quick question:
Can you import Lua modules from places other than this wiki and the local module namespace?
nope. and, in general case, you should not: imported module might be changed or even deleted at any time. on the dev wiki, all changes in the module will (at least try to very hard) keep backward compatibility.