Download and unzip a file from a Gadget ?

Hi,

My gadget needs to download (via HTTP) a zip file and unzip it. This file contains information so local search can be done on client side.

In Dashboard/Yahoo we have curl and unzip unix utilities to easily achieve that with some simple system call.

How can you do that with Microsoft Gadgets ?

Thanks in advance,

[326 byte] By [esenterre] at [2008-2-5]
# 1
I don't think MS's ZIP is exposed via COM, so you'd have to either include a command line based extractor in the Gadget, or write a COM wrapper DLL around MS's ZIP.

Your best bet is to get a free command line extractor, like 7-Zip and use it's 7z.exe command line EXE, which you can call from your Gadget as described in this thread.

Just bare in mind that you will run into security issues if you're extracting it to anywhere other than the Gadget directory (System.Gadget.path), or one of it's sub directories.

If you create blank subdirectories in your Gadget to do this, make sure there's at least one dummy file in them, otherwise Sidebar will report the Gadget is corrupt, and it won't install.

JonathanAbbott at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 2
You should be able to use good old pkzip via the command line
Tomfromcener.co.uk at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 3
Thanks for that answer. I already thought about that solution, but there's two things that I was concerned. The final size of the Gadget will be alot bigger, and maybe copyright issue from the author of such a 3rd party unzip software.

And how about to download the ZIP file itself ? Any ideas ?

Thanks in advance!

esenterre at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 4
PKZIP you can't distribute. 7-Zip you can as it comes under GNU, read the FAQ on their site.

Where the ZIP is coming from will determine how you download it.

JonathanAbbott at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 5
I'm very curious about how to download binary files from internet to local in pure javascript... I have no idea.
JohnHax at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 6
DOS ftp - is one way. If it's coming from an FTP site.
JonathanAbbott at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 7
why don't you write a app that downloads your file and extract the content
Tomfromcener.co.uk at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...
# 8
Tom : I don't think I can develop an app myself, I probably don't have the talent for that yet. I was simply hoping that Gadgets could offer more power to the developers.

Jonathan : No unfortunately, it's not FTP but HTTP.

So I'll surely have to package some Freeware/GNU applications inside the gadget itself for now...

Thanks for you help!

esenterre at 2007-9-3 > top of Msdn Tech,Gadgets,Sidebar Gadget Development...