---
title: CapacitorJS
pagination_prev: demos/frontend/index
pagination_next: demos/desktop/index
sidebar_position: 5
sidebar_custom_props:
summary: JS + Web View
---
## CapacitorJS
:::note
This demo was tested on an Intel Mac on 2022 August 26 with Svelte.
The iOS simulator runs iOS 15.5 on an iPhone 13 Pro Max.
:::
:::warning Telemetry
Before starting this demo, manually disable telemetry. On Linux and MacOS:
```bash
npx @capacitor/cli telemetry off
```
To verify telemetry was disabled:
```bash
npx @capacitor/cli telemetry
```
:::
### Integration Details
This example uses Svelte, but the same principles apply to other frameworks.
#### Reading data
The standard HTML5 File Input element logic works in CapacitorJS:
```html
{@html html}
```
#### Writing data
`@capacitor/filesystem` can write Base64 strings:
```html
{@html html}
```
### Demo
Complete Example (click to show)
0) Disable telemetry as noted in the warning.
Follow the [React Native demo](#demo) to ensure iOS and Android sims are ready.
1) Create a new Svelte project:
```bash
npm create vite@latest sheetjs-cap -- --template svelte
cd sheetjs-cap
```
2) Install dependencies:
```bash
npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz
npm i --save @capacitor/core @capacitor/cli @capacitor/ios @capacitor/filesystem
```
3) Create CapacitorJS structure:
```bash
npx cap init sheetjs-cap com.sheetjs.cap --web-dir=dist
npx cap add ios
```
4) Replace the contents of `src/App.svelte` with the following:
```html title="src/App.svelte"
SheetJS × CapacitorJS { version }
{@html html}
```
5) Test the app:
```bash
npm run build; npx cap sync; npx cap run ios
```
There are 3 steps: build the Svelte app, sync with CapacitorJS, and run sim.
This sequence must be run every time to ensure changes are propagated.