@nativescript/zip
A simple utility class for zipping and unzipping files in NativeScript
npm i --save @nativescript/zip
- Version: 6.0.0
- GitHub: https://github.com/NativeScript/plugins
- NPM: https://www.npmjs.com/package/%40nativescript%2Fzip
- Downloads:
- Last Day: 26
- Last Week: 140
- Last Month: 665
@nativescript/zip
npm install @nativescript/zip
Usage
Zip
see ZipOptions
import { Zip } from '@nativescript/zip';
import { path, knownFolders } from '@nativescript/core';
let zipPath = path.join(knownFolders.temp().path, 'stuff.zip');
let dest = path.join(knownFolders.documents().path, '/assets');
Zip.zip({
directory: dest,
archive: zipPath
});
Progress
import { Zip } from '@nativescript/zip';
import { path, knownFolders } from '@nativescript/core';
let zipPath = path.join(knownFolders.temp().path, 'stuff.zip');
let dest = path.join(knownFolders.documents().path, '/assets');
Zip.zip({
function onZipProgress(percent: number) {
console.log(`unzip progress: ${percent}`);
directory: dest,
archive: zipPath,
onProgress: onZipProgress
});
Unzip
see UnzipOptions
import { Zip } from '@nativescript/zip';
import { path, knownFolders } from '@nativescript/core';
let zipPath = path.join(knownFolders.temp().path, 'stuff.zip');
let dest = path.join(knownFolders.documents().path, '/assets');
Zip.unzip({
archive: zipPath,
directory: dest,
});
Progress
import { Zip } from '@nativescript/zip';
import { path, knownFolders } from '@nativescript/core';
let zipPath = path.join(knownFolders.temp().path, 'stuff.zip');
let dest = path.join(knownFolders.documents().path, '/assets');
Zip.unzip({
archive: zipPath,
directory: dest,
onProgress: onUnZipProgress,
});
function onUnZipProgress(percent: number) {
console.log(`unzip progress: ${percent}`);
}
License
Apache License Version 2.0