
var z = Fossil.Zip()
assert z
assert z inherits Fossil.Zip
assert 'Zip' === typename z
print('z =', z)
assert undefined === z.setRoot('a')


scope {
    var sz = Fossil.file.size(__FILE)
    const buf = api.Buffer(sz)
    assert 0 === buf.length()
    buf.readFile(__FILE)
    assert buf.length() === sz
    z.addBuffer( __FILE, buf )
    buf.capacity(0)
}

z.addFile('cgi/init.fossi1ish')

var ofile = __FILE + ".zip"
z.finish(ofile)
print("Created ZIP:", ofile)

assert !catch{z.addFile(__FILE)}
z.finalize()
assert catch{z.addFile(__FILE)}
