Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capawesome-team/capacitor-file-opener

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capawesome-team/capacitor-file-opener

Capacitor plugin to open a file with the default application.

  • 6.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.3K
increased by67.85%
Maintainers
0
Weekly downloads
 
Created
Source

@capawesome-team/capacitor-file-opener

Capacitor plugin to open a file with the default application.

Installation

If you are an Insider, see Getting started with Insiders and follow the instructions to install the plugin.

If you are not an Insider, please install the package from the public npm registry:

npm install @capawesome-team/capacitor-file-opener
npx cap sync

Android

You need to specify the directories that contain the files you want to open. To specify the directories, start by creating the file file_paths.xml in the res/xml/ subdirectory of your project (see Android docs).
This is an example:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <files-path name="files" path="." />
    <cache-path name="cache" path="." />
    <external-files-path name="external-files" path="." />
    <external-cache-path name="external-cache" path="." />
    <external-path name="external" path="." />
</paths>
Variables

This plugin will use the following project variables (defined in your app’s variables.gradle file):

  • $androidxDocumentFileVersion version of androidx.documentfile:documentfile (default: 1.0.1)

Configuration

No configuration required for this plugin.

Demo

A working example can be found here: robingenz/capacitor-plugin-demo

AndroidiOS

Usage

import { FileOpener } from '@capawesome-team/capacitor-file-opener';

const open = async () => {
  await FileOpener.openFile({
    path: 'content://com.android.providers.downloads.documents/document/msf%3A1000000073',
  });
};

API

openFile(...)

openFile(options: OpenFileOptions) => Promise<void>

Open a file with the default application.

ParamType
optionsOpenFileOptions

Since: 0.0.1


Interfaces

OpenFileOptions
PropTypeDescriptionSince
blobBlobThe blob instance of the file to open. Only available on Web.6.1.0
pathstringThe path of the file. Only available on Android and iOS.0.0.1
mimeTypestringThe mime type of the file. If not specified, the mime type will be determined. Only available on Android and iOS.0.0.1

Changelog

See CHANGELOG.md.

License

See LICENSE.

Keywords

FAQs

Package last updated on 21 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc