Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import deng.fzip.*;
- import flash.filesystem.*;
- import flash.filesystem.File;
- //retrieve the image from the "imgs" folder
- var myfile:File = new File("C:/Users/User/Desktop/zip/imgs/myimage.png");
- //zipping the image
- var zip:FZip = new FZip();
- zip.addFile(myfile.name, myfile.data);
- //saving the image to the user's desktop
- var ba:ByteArray = new ByteArray();
- zip.serialize(ba);
- ba.position = 0;
- var finalZIP:File = File.desktopDirectory.resolvePath("myfile.zip");
- var fs:FileStream = new FileStream();
- fs.open(finalZIP, FileMode.WRITE);
- fs.writeBytes(ba);
- fs.close();
Add Comment
Please, Sign In to add comment