npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@capacitor-community/file-opener

v6.0.1

Published

Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri.

Downloads

179,910

Readme

Table of Contents

Maintainers

| Maintainer | GitHub | Active | | ---------- | ------------------------------- | ------ | | ryaa | ryaa | yes |

About

This plugin is similar to cordova-plugin-file-opener2 but without installation support.

Plugin versions

| Capacitor version | Plugin version | | ----------------- | -------------- | | 6.x | 6.x | | 5.x | 1.0.5 | | 4.x | 1.0.4 |

Installation

npm install @capacitor-community/file-opener
npx cap sync

Usage

import { FileOpener, FileOpenerOptions } from '@capacitor-community/file-opener';

try {
  const fileOpenerOptions: FileOpenerOptions = {
    filePath: 'file:///path/to/file',
    contentType: 'application/pdf',
    openWithDefault: true,
  };
  await FileOpener.open(fileOpenerOptions);
} catch (e) {
  console.log('Error opening file', e);
}

API

open(...)

open(options: FileOpenerOptions) => Promise<void>

Method to open a file.

| Param | Type | | ------------- | --------------------------------------------------------------- | | options | FileOpenerOptions |

Since: 1.0.0


Interfaces

FileOpenerOptions

file open method options

| Prop | Type | Description | Since | | --------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- | | filePath | string | file path | 1.0.0 | | contentType | string | MIME type (optional) | 1.0.0 | | openWithDefault | boolean | Use the default platform chooser, if true, otherwise: On Android: it will show "Open File in.." title of the chooser dialog, the system will always present the chooser dialog even if the user has chosen a default one and if no activity is found to handle the file, the system will still present a dialog with the specified title and an error message No application can perform this action On iOS: it will presents a menu restricted to a list of apps capable of opening the current document. This determination is made based on the document type and on the document types supported by the installed apps. To support one or more document types, an app must register those types in its Info.plist file using the CFBundleDocumentTypes key. (optional) default value is true | 1.0.0 | | chooserPosition | { x: number; y: number; } | (iOS only; iPad only) Position to anchor the chooser (ShareSheet) menu in the view (optional) Please note that this is applicable only when the application runs on iPad and when openWithDefault is false, otherwise this is ignored | 1.0.3 |

List of Error Codes and Meanings

When an error is thrown, one of the following codes (as a string value) will be used.

| Code | Description | | ----: | :------------------- | | '1' | INTERNAL_ERROR | | '2' | INVALID_ARGUMENT | | ' '8' | FILE_NOT_SUPPORTED | | '9' | FILE_NOT_FOUND | | '10' | UNKNOWN |

Android

If you app needs to open files in the external directories, then within your AndroidManifest.xml file, change the following:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example">

+  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

</manifest>

iOS

You'll need to set ios/App/Podfile to version 13 or higher (for more details please see)

platform :ios '13.0'

then npx cap sync ios