Zvfs stands for Zip Virtual File System, which is used by Jsi to read and write zip files.
There are two important uses of Zvfs:
- Running scripts directly from .zip files.
- Running scripts zipped into the jsish binary (zero-install).
In both cases the Zip archive can contain all files (scripts, web pages, images, etc) required by an application, and thus can deploy complete working standalone applications.
Jsi can execute a zip archive that contains main.jsi or lib/main.jsi, eg:
# jsish DebugUI.zip my.jsi arg1 arg2
Jsi mounts the .zip file on /zvfs1, then executes main.jsi (or lib/main.jsi) therein.
Any other resources contained in the archive are also available to Jsi.
It is also possible to zip "main.jsi (and other files) directly onto the end of the jsish binary itself. This lets jsish be used to deploy Zero-Install, standalone application.
The simplesst way to create a Zero-Install application is to copy your scripts into lib/ then use:
The direct approach uses the script "tools/mkjsize.js":
cp jsish jsize tools/mkjsize.js create jsize zipdir
See ./usingjsi.wiki#examples for concrete working example applications.
To create a zip archive simpy use:
Zvfs.create('arch.zip', file.glob('*.js'))This creates a zip file containing all the .js files in the current directory.
ReadingJsi can mount .zip files as local filesystem:
var dir = Zvfs.mount('arch.zip'); File.glob('*', dir);
Note: If a mount point is not given, it is generated in the pattern /zvfsN, where N=1,2,3,...