Socket
Book a DemoInstallSign in
Socket

@makiwin/cordova-plugin-saf-mediastore

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@makiwin/cordova-plugin-saf-mediastore

Cordova Plugin to read and save files using the Storage Access Framework and Mediastore on Android only.

1.0.15
latest
Source
npmnpm
Version published
Weekly downloads
18
-30.77%
Maintainers
1
Weekly downloads
 
Created
Source

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.

existsFile(filename: string): Promise<string>;

From a filename check if the files exist in the shared download folder return uri of the corresponding file if exists, otherwise return -1

getDataForOpenFile(uri: string): Promise<{
    uri: string;
    mimeType: string;
    filename: string;
  }>;

From Content URI return information about the file

To call methods:

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

Keywords

cordova

FAQs

Package last updated on 10 Apr 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.