A Capacitor plugin for importing and processing files from Android and iOS devices.
npm install fileupload-plugin-xnodeA Capacitor plugin for importing and processing files from Android and iOS devices.
Install the plugin using npm:
``bash`
npm install fileupload-plugin
npx cap sync
* processFile(...)
* Interfaces
* Type Aliases
`typescript`
processFile(options: { filePath: string; type: string; name: string; }) => Promise<{ base64: string; size: number; type: string; fileName: string; byteArray: Uint8Array; }>
#### Parameters
| Param | Type | Description |
| ------------- | -------------------------------------------------------------- | -------------------------------- |
| options | { filePath: string; type: string; name: string; } | File processing options. |
#### Returns
A promise resolving to:
`typescript`
{
base64: string;
size: number;
type: string;
fileName: string;
byteArray: Uint8Array;
}
--------------------
Import and use the plugin in your code:
`typescript
import { Plugins } from '@capacitor/core';
const { FileuploadPlugin } = Plugins;
async function uploadFile() {
const result = await FileuploadPlugin.processFile({
filePath: 'path/to/file',
type: 'image/png',
name: 'example.png'
});
console.log('Base64:', result.base64);
console.log('File Size:', result.size);
}
``
MIT License