Guest User

Untitled

a guest
Nov 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import deng.fzip.*;
  2. import flash.filesystem.*;
  3. import flash.filesystem.File;
  4.  
  5. //retrieve the image from the "imgs" folder
  6. var myfile:File = new File("C:/Users/User/Desktop/zip/imgs/myimage.png");
  7.  
  8. //zipping the image
  9. var zip:FZip = new FZip();
  10. zip.addFile(myfile.name, myfile.data);
  11.  
  12. //saving the image to the user's desktop
  13. var ba:ByteArray = new ByteArray();
  14. zip.serialize(ba);
  15. ba.position = 0;
  16. var finalZIP:File = File.desktopDirectory.resolvePath("myfile.zip");
  17. var fs:FileStream = new FileStream();
  18. fs.open(finalZIP, FileMode.WRITE);
  19. fs.writeBytes(ba);
  20. fs.close();
Add Comment
Please, Sign In to add comment