Imported from bekaku/vue-ionic-example-app (
.agents/skills/mobile-files-media/SKILL.md). Install upstream withnpx skills add bekaku/vue-ionic-example-app --skill mobile-files-media. Copyright stays with the author.
mobile-files-media — Canonical Skill
Purpose
Enforce the verified file/media pipeline with platform-safe URI handling.
When to use
Camera capture, photo picking, chunked upload, download/open/share, save to gallery, permissions, scoped-storage/sandbox paths.
Required reading
skills/mobile/FILES_MEDIA.md
Relevant project locations
src/composables/useFileSystem.ts(active picker/save path),src/composables/useUpload.ts(active upload path)src/composables/useCamera.ts(currently no import callers)src/composables/useFileDownload.ts,src/utils/FileUtils.tssrc/api/FileManagerService.ts
Mandatory rules
- Camera:
getPhotoUri +webUseInput,pickImages. Web has no gallery:savePicture/saveFilefall back to a browser download. - Save pipeline: base64 →
Filesystem.writeFile(Directory.Data) →Media.savePhotointoAppAlbumNamealbum. - Upload defaults: 1 MB chunks, one attempt unless
maxRetriesis overridden;FormDatauploadChunkApithen merge DTOmergeChunkApi. In-memory chunk tracking is not restart-safe resume. - Validate paths, MIME, filenames; respect scoped storage / sandbox; request
minimal permissions with
isWeb()guards. - Blob URLs from
fethCdnDatamust be released: useuseBlobUrls()(track+ auto-revoke on unmount), asBaseImage/BaseAvatardo. Downloads that must land on the device useuseFileDownload.
Implementation workflow
- Trace the caller's capture/pick → convert → store/upload → cleanup chain;
do not assume the unreferenced
useCamera.tsis the active path. - Handle permission-denied, cancel, retry-exhausted, large-file paths.
- Clean temp files; confirm user-visible export location.
- Verify per
mobile-testing, incl. SECURITY (untrusted files).
Verification
Mocked picker/upload unit tests; real capture/save/share only on device.