Guide
Tutoriel sur le téléchargement
En utilisant @capgo/capacitor-downloader
Capacitor : plugin de téléchargement de fichiers avec un support de fond. Propose des téléchargements résumables avec un suivi de progression.
Installer
bun add @capgo/capacitor-downloader
bunx cap sync
Ce que ce plugin expose
download- Lancer une nouvelle tâche de téléchargement.pause- Mettre en pause une tâche de téléchargement active. Le téléchargement peut être repris ultérieurement à la même position.resume- Reprendre une tâche de téléchargement mise en pause. Continue à partir de l'endroit où elle a été mise en pause.stop- Arrêter et annuler une tâche de téléchargement définitivement. Les données téléchargées seront supprimées.
Exemple d'utilisation
download
Lancer une nouvelle tâche de téléchargement.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const task = await Downloader.download({
id: 'my-download',
url: 'https://example.com/file.pdf',
destination: 'downloads/file.pdf'
});
pause
Pausez une téléchargement active. Le téléchargement peut être repris ultérieurement à la même position.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({} as { id: string });
resume
Résumez un téléchargement suspendu. Il continue depuis où il était suspendu.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({} as { id: string });
stop
Arrêtez et annulez un téléchargement définitivement. Les données téléchargées seront supprimées.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({} as { id: string });
Référence complète
- GitHub : https://github.com/Cap-go/capacitor-downloader/
- Documentation : /docs/plugins/downloader/
Continuez à partir de l'utilisation de @capgo/capacitor-downloader
Si vous utilisez L'utilisation de @capgo/capacitor-downloader pour planifier la migration et les opérations d'entreprise, connectez-l’avec @capgo/capacitor-downloader pour les détails d'implémentation dans @capgo/capacitor-téléchargeur Prise en main pour les détails d'implémentation dans Prise en main Capgo Entreprise for the product workflow in Capgo Enterprise, pour le flux de travail du produit dans __CAPGO_KEEP_0__ Entreprise Ionic Entreprise Plugin Alternatives Capgo Alternatives Capgo Alternatives