zip - vb.net Download file and unzip it -
i want download file .zip in vb, , decompress when download have reached 100%, here code download file:
wc.downloadfileasync(new uri(http://google.zip), "c:\documents , settings\all users\documents\google.zip") sw.start()
what need add decompress google.zip when download have reached 100%?
dim saveas string="c:\documents , settings\all users\documents\google.zip" dim theresponse httpwebresponse dim therequest httpwebrequest try 'checks if file exist therequest = webrequest.create(fileurl) 'fileurl zip url theresponse = therequest.getresponse catch ex exception 'could not found on server (network delay maybe) exit sub 'exit sub or function, because if not found can't downloaded end try dim length long = theresponse.contentlength dim writestream new io.filestream(saveas, io.filemode.create) dim nread integer dim readbytes(4095) byte dim bytesread integer = theresponse.getresponsestream.read(readbytes, 0, 4096) nread += bytesread if bytesread = 0 exit writestream.write(readbytes, 0, bytesread) loop theresponse.getresponsestream.close() writestream.close() 'file downloaded 100%
unzipping file simple-> https://msdn.microsoft.com/en-us/library/ms404280%28v=vs.110%29.aspx
Comments
Post a Comment