nativescript-zip
TypeScript icon, indicating that this package has built-in type declarations

4.0.2 • Public • Published

npm npm Build Status

NativeScript Zip

Installation

NativeScript 4x

  • tns plugin add nativescript-zip

NativeScript 2x & 3x

  • tns plugin add nativescript-zip@2.0.4

Usage

Zip

import { Zip } from "nativescript-zip";
import * as fs from "tns-core-modules/file-system";
let path = fs.path.join(fs.knownFolders.temp().path, "stuff");
let dest = fs.path.join(fs.knownFolders.documents().path, "/assets");
Zip.zip({
    folder: path,
    destination: dest
});

Progress

import { Zip } from "nativescript-zip";
import * as fs from "tns-core-modules/file-system";
let path = fs.path.join(fs.knownFolders.temp().path, "stuff");
let dest = fs.path.join(fs.knownFolders.documents().path, "/assets");
Zip.zip({
    folder: path,
    destination: dest,
    onProgress: onZipProgress
});
 
function onZipProgress(percent: number) {
    console.log(`unzip progress: ${percent}`);
}

Unzip

import { Zip } from "nativescript-zip";
import * as fs from "tns-core-modules/file-system";
let zipPath = fs.path.join(fs.knownFolders.temp().path, "stuff.zip");
let dest = fs.path.join(fs.knownFolders.documents().path, "/assets");
Zip.unzip({
    archive: zipPath,
    destination: dest
});

Progress

import { Zip } from "nativescript-zip";
import * as fs from "tns-core-modules/file-system";
let zipPath = fs.path.join(fs.knownFolders.temp().path, "stuff.zip");
let dest = fs.path.join(fs.knownFolders.documennts().path, "/assets");
Zip.unzip({
    archive: zipPath,
    destination: dest,
    onProgress: onUnZipProgress
});
 
function onUnZipProgress(percent: number) {
    console.log(`unzip progress: ${percent}`);
}

TODO

  • Compress method
  • Progress

Package Sidebar

Install

npm i nativescript-zip

Weekly Downloads

13

Version

4.0.2

License

Apache-2.0

Unpacked Size

125 kB

Total Files

17

Last publish

Collaborators

  • ddaf
  • triniwiz