jsish
Zvfs
Not logged in

./reference.wiki#zvfs

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:

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.


Executing Zips

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.


Zero-Install

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:

make jsize

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.



Writing

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.

Reading

Jsi 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,...