FortuneN / cordova-plugin-zeep

Zip compression/decompression for the cordova/phonegap platform
Apache License 2.0
28 stars 37 forks source link

How to import in ionic 3? #26

Closed theer1k closed 5 years ago

theer1k commented 5 years ago

I need an example like this, but using ionic 3, importing with ts e etc:

app = angular.module('MyApp', ['ngCordova.plugins.zeep'])
app.controller('MyController', function($scope, $cordovaZeep) {

    var source    = cordova.file.applicationDirectory,
        zip       = cordova.file.cacheDirectory + 'source.zip',
        extracted = cordova.file.cacheDirectory + 'extracted';

    console.log('source    : ' + source   );
    console.log('zip       : ' + zip      );
    console.log('extracted : ' + extracted);

    console.log('zipping ...');

    $cordovaZeep.zip({
        from : source,
        to   : zip
    }).then(function() {

        console.log('zip success!');
        console.log('unzipping ...');

        $cordovaZeep.unzip({
            from : zip,
            to   : extracted
        }).then(function() {
            console.log('unzip success!');
        }, function(e) {
            console.log('unzip error: ', e);
        });

    }, function(e) {
        console.log('zip error: ', e);
    });

});
theer1k commented 5 years ago

I was able to use this plugin on ionic 3 by adding it and declaring like this:


const zip = (<any>window).Zeep.zip;