UNPKG

ionic-native

Version:

Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support

51 lines 2.34 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { Cordova, Plugin } from './plugin'; /** * @name Base64 To Gallery * @description This plugin allows you to save base64 data as a png image into the device * @usage * ```typescript * import { Base64ToGallery } from 'ionic-native'; * * * Base64ToGallery.base64ToGallery(base64Data, 'img_').then( * res => console.log('Saved image to gallery ', res), * err => console.log('Error saving image to gallery ', err) * ); * ``` */ export var Base64ToGallery = (function () { function Base64ToGallery() { } /** * Converts a base64 string to an image file in the device gallery * @param {string} data The actual base64 string that you want to save * @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. * @returns {Promise<any>} returns a promise that resolves when the image is saved. */ Base64ToGallery.base64ToGallery = function (data, options) { return; }; __decorate([ Cordova({ successIndex: 2, errorIndex: 3 }) ], Base64ToGallery, "base64ToGallery", null); Base64ToGallery = __decorate([ Plugin({ pluginName: 'Base64ToGallery', plugin: 'cordova-base64-to-gallery', pluginRef: 'cordova', repo: 'https://github.com/Nexxa/cordova-base64-to-gallery', platforms: ['Android', 'iOS', 'Windows Phone 8'] }) ], Base64ToGallery); return Base64ToGallery; }()); //# sourceMappingURL=base64togallery.js.map