phonegap / phonegap-plugin-contentsync

Download and cache remotely hosted content
Apache License 2.0
206 stars 98 forks source link

Download inside a specific folder #38

Closed hashg closed 9 years ago

hashg commented 9 years ago

My scenario is app.zip sub01.zip sub02.zip

Now I want to first download app.zip, then unzip sub01.zip and sub02.zip inside app folder.

app
 |
 +-- sub01
 |
 +-- sub02

How can I do it? This allows me to add sub03 or sub04 later in future.

macdonst commented 9 years ago

Try the following:

var sync = ContentSync.sync({ src: 'http://myserver/assets/app.zip', id: 'app', type: 'replace' });

sync.on('complete', function(data) {
  var sync2 = ContentSync.sync({ src: 'http://myserver/assets/sub01.zip', id: 'app/sub01', type: 'merge' });
});
revolunet commented 9 years ago

i can confirm this works

hashg commented 9 years ago

I'm between builds. I will try it over the weekend. Thanks for @revolunet confirming it.