An open API service indexing awesome lists of open source software.

https://github.com/pharma71/capacitor-disk-space


https://github.com/pharma71/capacitor-disk-space

Last synced: over 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# Capacitor Disk Space Plugin

A Capacitor plugin to retrieve disk space information on Android and iOS.

## Installation
```sh
npm install capacitor-disk-space
npx cap sync
```

## Usage
```ts
import { DiskSpace } from 'capacitor-disk-space';

async function checkDiskSpace() {
const info = await DiskSpace.getDiskSpace();
console.log(`Total: ${info.total} bytes`);
console.log(`Free: ${info.free} bytes`);
console.log(`Used by App: ${info.usedByApp} bytes`);
}

checkDiskSpace();
```

## API

### `getDiskSpace()`
Returns an object containing:
- `total`: Total disk space in bytes.
- `free`: Free disk space in bytes.
- `usedByApp`: Space used by the app in bytes.

## License
MIT

* [`getDiskSpace()`](#getdiskspace)
* [Interfaces](#interfaces)

### getDiskSpace()

```typescript
getDiskSpace() => Promise
```

**Returns:** Promise<DiskSpaceInfo>

--------------------

### Interfaces

#### DiskSpaceInfo

| Prop | Type |
| ------------------ | ------------------- |
| **`totalSpace`** | number |
| **`freeSpace`** | number |
| **`appUsedSpace`** | number |