capacitor.nativescript.org Open in urlscan Pro
2a05:d014:58f:6200::64  Public Scan

Submitted URL: http://capacitor.nativescript.org/
Effective URL: https://capacitor.nativescript.org/
Submission: On March 22 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

NativeScript Capacitor

v5.0.2
Introduction
Setup
Docs
Solutions
GitHub
v5.0.2
Introduction
Setup
Docs
Solutions
GitHub



NATIVESCRIPT FOR CAPACITOR

The platform at your fingertips.
Get Started →


ISOLATED NATIVESCRIPT ENVIRONMENT

Use NativeScript within your existing Capacitor app.

./src/nativescript/zip.ts

import { Zip } from "@nativescript/zip";
import { notifyEvent } from "@nativescript/capacitor/bridge";

interface ZipOptions {
    directory: string,
    archive: string
}

native.fileZip = function (options: ZipOptions) {
  const { directory, archive } = options;
  Zip.zip({
    directory,
    archive,
    onProgress: (progress) => {
      notifyEvent('zipProgress', progress);
    },
  }).then((filePath) => {
    notifyEvent('zipComplete', filePath);
  });
};


./src/app/explore-container/explore-container.component.ts

import { native } from '@nativescript/capacitor';

export class ExploreContainerComponent {
  fileZip() {
    native.onEvent('zipComplete', (filePath: string) => {
      console.log('zip created at:', filePath);
    });
      
    native.fileZip({
      directory: 'assets',
      archive: 'assets.zip'
    });
  }
}



USE ANYWHERE IN YOUR IONIC CODEBASE

Completely inactive with zero impact on your web environment. It is only active
when Capacitor is running.