Giter Club home page Giter Club logo

cordova-plugin-saf-mediastore's Introduction

cordova-plugin-saf-mediastore

Read and save files using the Storage Access Framework and Mediastore

This plugin allows you to read and save files using the Storage Access Framework and Mediastore on Android only.

Available methods

selectFolder(uri:string):Promise<string>

Launches an Intent to select a folder to which files can be saved. Returns the content URI.

selectFile(uri:string):Promise<string>

Launches an Intent to select a file. Returns the content URI.

openFolder(uri:string):Promise<void>

Launches an Intent to open a folder in the folder picker.

openFile(uri:string):Promise<void>

Launches an Intent to open a file.

readFile(uri:string):Promise<ArrayBuffer>

Reads a file as an ArrayBuffer.

writeFile(params:{
	data:string,
	filename:string,
	folder?:string,
	subFolder?:string
}):Promise<string>

Writes a file to a specific filename, with the folder and subfolder being optional. The subfolder will be created if it does not exist, and the default folder is the Downloads folder (saved via Mediastore). Returns the content URI. data is a Base 64 string.

overwriteFile(params:{
    uri:string,
    data:string
}):Promise<string>

Overwrites a file at a specific content URI. Returns the content URI.

saveFile(params:{
	data:string,
	filename?:string,
	folder?:string
}):Promise<string>

Launches a file picker Intent to save a file, with the preferred filename and folder being optional. Returns the content URI. data is a Base 64 string.

deleteFile(uri:string):Promise<number>

Deletes a file at a specific content URI. Returns the number of files deleted.

getFileName(uri:string):Promise<string>

Returns the filename of the corresponding content URI.

getUri(params:{
    folder:string,
    subFolder?:string,
    filename?:string,
}):Promise<string>

Returns the content URI of the file in the corresponding folder and subfolder.

To call methods:

cordova.plugins.safMediastore.<function>(params); //returns a Promise
await cordova.plugins.safMediastore.<function>(params); //in an async function

cordova-plugin-saf-mediastore's People

Contributors

customautosys avatar surajahmed avatar kumarpratik avatar chancezeus avatar

Forkers

sachithd

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.