I'm using Capacitor 6.0.3 with @capacitor/share.
According to the docs, ShareOptions supports:
- title
- text
- url (http, https, file://)
- files (array of file:// URLs)
My problem:
I have an image generated in WebView (screenshot) as a data URL / Blob / base64 string.
I want to share this image using Share plugin without manually creating a file URI.
What I tried:
- Passing
data:image/png;base64,... to url → not supported
- Passing
blob: URL → not supported
- Creating
File object in JS → native layer can't access it
navigator.share → unreliable in Android WebView
Current working solution:
Save base64 to Filesystem (Cache) → getUri → Share.share({ files: [uri] })
Question:
Is there any supported or recommended way in Capacitor 6 to share an image
directly from memory (base64/blob) without writing it to the filesystem,
or is writing a temporary file the only correct approach?
Environment:
- Capacitor 6.0.3
- @capacitor/share 6.0.3
- Android WebView (Ionic/Capacitor app)
I'm using Capacitor 6.0.3 with @capacitor/share.
According to the docs, ShareOptions supports:
My problem:
I have an image generated in WebView (screenshot) as a data URL / Blob / base64 string.
I want to share this image using Share plugin without manually creating a file URI.
What I tried:
data:image/png;base64,...tourl→ not supportedblob:URL → not supportedFileobject in JS → native layer can't access itnavigator.share→ unreliable in Android WebViewCurrent working solution:
Save base64 to Filesystem (Cache) → getUri → Share.share({ files: [uri] })
Question:
Is there any supported or recommended way in Capacitor 6 to share an image
directly from memory (base64/blob) without writing it to the filesystem,
or is writing a temporary file the only correct approach?
Environment: