UNPKG

2.4 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @name Base64 To Gallery
11 * @description This plugin allows you to save base64 data as a png image into the device
12 * @usage
13 * ```typescript
14 * import { Base64ToGallery } from 'ionic-native';
15 *
16 *
17 * Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
18 * res => console.log('Saved image to gallery ', res),
19 * err => console.log('Error saving image to gallery ', err)
20 * );
21 * ```
22 */
23var Base64ToGallery = (function () {
24 function Base64ToGallery() {
25 }
26 /**
27 * Converts a base64 string to an image file in the device gallery
28 * @param {string} data The actual base64 string that you want to save
29 * @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
30 * @returns {Promise<any>} returns a promise that resolves when the image is saved.
31 */
32 Base64ToGallery.base64ToGallery = function (data, options) {
33 return;
34 };
35 __decorate([
36 plugin_1.Cordova({
37 successIndex: 2,
38 errorIndex: 3
39 })
40 ], Base64ToGallery, "base64ToGallery", null);
41 Base64ToGallery = __decorate([
42 plugin_1.Plugin({
43 pluginName: 'Base64ToGallery',
44 plugin: 'cordova-base64-to-gallery',
45 pluginRef: 'cordova',
46 repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
47 platforms: ['Android', 'iOS', 'Windows Phone 8']
48 })
49 ], Base64ToGallery);
50 return Base64ToGallery;
51}());
52exports.Base64ToGallery = Base64ToGallery;
53//# sourceMappingURL=base64togallery.js.map
\No newline at end of file