ZipWriteStream
is only a helper class used for compressing, it does not know how a proper ZIP file is layed out, with all the header and directory information etc. You want to use the ZipArchive
class.
"first, construct archive layout in memory"
zip := ZipArchive new.
zip addFile: 'foo.txt'.
zip addFile: 'bar.txt' as: 'xyz.txt'.
zip addTree: dir match: [:entry | entry name beginswith: 'baz'].
"then, write archive to disk, compressing each member"
file := dest newFileNamed: 'test.zip'.
zip writeTo: file.
file close.