GithubHelp home page GithubHelp logo

wagnerhsu / cordova-plugin-filebrowser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ourcodeworld/cordova-ourcodeworld-filebrowser

0.0 1.0 0.0 23 KB

A native Android filebrowser (select and create files and folders) for Cordova

License: MIT License

JavaScript 32.47% Java 67.53%

cordova-plugin-filebrowser's Introduction

cordova-ourcodeworld-filebrowser Plugin

A cordova implementation of NoNonsense-FilePicker for Android.

This plugin allow you to select folder and files, and at the same time create folders and create files (not a file is created actually, but it will return the filepath and name of the "choosen path").

Installation

Install the plugin

$ cordova plugin add https://github.com/ourcodeworld/cordova-ourcodeworld-filebrowser.git

After installing the plugin, remember that the targetSdkVersion of cordova needs to be less than 24 e.g in Cordova 9.0.1, you need to specify inside the config.xml file of your project:

<platform name="android">
    <preference name="android-minSdkVersion" value="19" />
    <preference name="android-targetSdkVersion" value="23" />
</platform>

Usage

A global object OurCodeWorld.Filebrowser will be available in your window. This object offers a file picker, folder picker, mixed folder and file picker and the file creation dialog.

// Single file selector
window.OurCodeWorld.Filebrowser.filePicker.single({
    success: function(data){
        if(!data.length){
            // No file selected
            return;
        }

        // Array with filepaths
        // ["file:///storage/emulated/0/360/security/file.txt", "file:///storage/emulated/0/360/security/another-file.txt"]
    },
    error: function(err){
        console.log(err);
    }
});

// Single folder selector
window.OurCodeWorld.Filebrowser.folderPicker.single({
    success: function(data){
        if(!data.length){
            // No folders selected
            return;
        }

        // Array with paths
        // ["file:///storage/emulated/0/360/security", "file:///storage/emulated/0/360/security"]
        console.log(data);
    },
    error: function(err){
        console.log(err);
    }
});

Check the documentation to see more methods of the plugin like the creation of file, mixed file and folder picker etc.

External links

cordova-plugin-filebrowser's People

Contributors

sdkcarlos avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.