Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publishing

on:
push:
branches:
- master
- develop

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npm i
- name: Release
if: github.ref_name == 'master'
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Next
if: github.ref_name == 'develop'
run: npm publish --access public --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40 changes: 14 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Chooser

## Demo
[cordova-plugin-chooser-lab](https://github.com/MaximBelov/cordova-plugin-chooser-lab)

## Overview

File chooser plugin for Cordova.

Install with Cordova CLI:

$ cordova plugin add cordova-plugin-chooser
$ cordova plugin add @herdwatch/cordova-plugin-chooser

Supported Platforms:

Expand All @@ -19,37 +22,22 @@ Supported Platforms:
/**
* Displays native prompt for user to select a file.
*
* @param accept Optional MIME type filter (e.g. 'image/gif,video/*').
*
* @returns Promise containing selected file's raw binary data,
* base64-encoded data: URI, MIME type, display name, and original URI.
*
* If user cancels, promise will be resolved as undefined.
* If error occurs, promise will be rejected.
*/
chooser.getFile(accept?: string) : Promise<undefined|{
data: Uint8Array;
dataURI: string;
mediaType: string;
name: string;
uri: string;
}>

/**
* Displays native prompt for user to select a file.
*
* @param accept Optional MIME type filter (e.g. 'image/gif,video/*').
* @param {Object} options
* @param {string} options.mimeTypes Optional MIME type filter (e.g. 'image/gif,video/*')
* @param {number} options.maxFileSize
*
* @returns Promise containing selected file's MIME type, display name,
* and original URI.
* @returns Promise containing selected file's
* path, display name, MIME type, , and original URI.
*
* If user cancels, promise will be resolved as undefined.
* If error occurs, promise will be rejected.
*/
chooser.getFileMetadata(accept?: string) : Promise<undefined|{
mediaType: string;
chooser.getFile(options?: {}) : Promise<undefined|{
path: string;
name: string;
uri: string;
mimeType: string;
extension: string;
size: number;
}>

## Example Usage
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "cordova-plugin-chooser",
"version": "1.3.2",
"name": "@herdwatch/cordova-plugin-chooser",
"version": "1.4.0",
"description": "Cordova file chooser plugin",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/cyph/cordova-plugin-chooser.git"
"url": "git+https://github.com/herdwatch-apps/cordova-plugin-chooser.git"
},
"keywords": [
"file",
Expand All @@ -18,10 +18,10 @@
"author": "Cyph, Inc. <[email protected]> (https://github.com/cyph)",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/cyph/cordova-plugin-chooser/issues"
"url": "https://github.com/herdwatch-apps/cordova-plugin-chooser/issues"
},
"cordova": {
"id": "cordova-plugin-chooser",
"id": "@herdwatch/cordova-plugin-chooser",
"platforms": [
"android",
"ios"
Expand Down
13 changes: 6 additions & 7 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin
xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-chooser"
version="1.3.1"
>
<plugin
xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="@herdwatch/cordova-plugin-chooser"
version="1.4.0"
>
<name>Chooser</name>
<author>Cyph, Inc.</author>

Expand All @@ -24,7 +24,6 @@

<platform name="ios">
<source-file src="src/ios/Chooser.swift" />
<dependency id="cordova-plugin-add-swift-support" version="*" />

<config-file target="config.xml" parent="/*">
<feature name="Chooser">
Expand Down
Loading