ガイド
ファイル圧縮用のチュートリアル
使用方法:@capgo/capacitor-file-compressor
Capacitorのファイル圧縮プラグインインターフェイス
インストール
bun add @capgo/capacitor-file-compressor
bunx cap sync
このプラグインが公開するもの
compressImage- 指定されたサイズと品質設定で画像ファイルを圧縮します。
例の使用
compressImage
指定されたサイズと品質設定で画像ファイルを圧縮します。
import { FileCompressor } from '@capgo/capacitor-file-compressor';
// Web - Compress from file input
const fileInput = document.getElementById('file') as HTMLInputElement;
const file = fileInput.files[0];
const result = await FileCompressor.compressImage({
blob: file,
quality: 0.8,
width: 1200,
mimeType: 'image/jpeg'
});
const url = URL.createObjectURL(result.blob);
フル リファレンス
- GitHub: https://github.com/Cap-go/capacitor-file-compressor/
- ドキュメント: /docs/plugins/file-compressor/
使用中の@capgo/capacitor-file-compressorから続けてください
あなたが使用している場合 使用中の@capgo/capacitor-file-compressor データの保存とファイルの管理を計画し、接続する @capgo/capacitor-file-compressor Capgoの実装詳細については、@capgo/capacitor-file-compressorを参照してください Getting Started Capgoの実装詳細については、Getting Startedを参照してください @capgo/capacitor-data-storage-sqlite Capgoの実装詳細については、@capgo/capacitor-data-storage-sqliteを参照してください Using @capgo/capacitor-data-storage-sqlite for the native capability in Using @capgo/capacitor-data-storage-sqlite, and @capgo/capacitor-file for the implementation detail in @capgo/capacitor-file.