npm i --save @martinbuezas/nativescript-share-file
- Version: 3.0.0
- GitHub: https://github.com/martinbuezas/nativescript-plugins
- NPM: https://www.npmjs.com/package/%40martinbuezas%2Fnativescript-share-file
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
@martinbuezas/nativescript-share-file
ns plugin add @martinbuezas/nativescript-share-file
Send/Share files to other apps.
Android Intent, IOS InteractionController:
.
Usage
Info: Shared files should be in the documents
path.
import { ShareFile } from 'nativescript-share-file';
import * as fs from 'tns-core-modules/file-system';
export class TestClass{
shareFile;
fileName;
documents;
path;
file;
constructor() {
this.fileName = 'text.txt';
this.documents = fs.knownFolders.documents();
this.path = fs.path.join(this.documents.path, this.fileName);
this.file = fs.File.fromPath(this.path);
this.shareFile = new ShareFile();
this.shareFile.open( {
path: this.path,
intentTitle: 'Open text file with:', // optional Android
rect: { // optional iPad
x: 110,
y: 110,
width: 0,
height: 0
},
options: true, // optional iOS
animated: true // optional iOS
});
}
}
Arguments
path
Path to the file which will be shared.
String
: Required
intentTitle
Title for the intent on Android.
String
: (Optional)
Default: Open file:
.
rect
Positioning the view for iPads. On iPhones it's always shown on the bottom.
Object
: (Optional)
Default: {x: 0, y: 0, width: 0, height: 0 }
.
options
Show additional opening options for iOS devices.
Boolean
: (Optional)
Default: false
.
animated
Opening animation for iOS devices.
Boolean
: (Optional)
Default: false
.
License
Apache License Version 2.0