├── .gitattributes ├── .gitignore ├── LICENSE.md ├── README.md ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── fr │ └── snapp │ └── imagebase64 │ ├── RNImgToBase64Module.java │ └── RNImgToBase64Package.java ├── index.js ├── ios ├── RNImgToBase64.h ├── RNImgToBase64.m └── RNImgToBase64.xcodeproj │ └── project.pbxproj ├── package.json └── react-native-image-base64.podspec /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # OSX 3 | # 4 | .DS_Store 5 | 6 | # node.js 7 | # 8 | node_modules/ 9 | npm-debug.log 10 | yarn-error.log 11 | 12 | 13 | # Xcode 14 | # 15 | build/ 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | xcuserdata 25 | *.xccheckout 26 | *.moved-aside 27 | DerivedData 28 | *.hmap 29 | *.ipa 30 | *.xcuserstate 31 | project.xcworkspace 32 | 33 | 34 | # Android/IntelliJ 35 | # 36 | build/ 37 | .idea 38 | .gradle 39 | local.properties 40 | *.iml 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Snapp SAS 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # react-native-image-base64 3 | 4 | This repo is a working rewrite of [this](https://github.com/xfumihiro/react-native-image-to-base64) abandoned library. 5 | It provides a very simple way to convert an image to a base64 string. 6 | 7 | If you encounter `OOM` errors on old android devices, make sure you optimize the image's size before you convert it. 8 | Indeed working with big images on Android might cause very high memory usage. 9 | 10 | ## Getting started 11 | 12 | `npm install react-native-image-base64 --save` 13 | or 14 | `yarn add react-native-image-base64` 15 | 16 | 17 | ## Installation 18 | 19 | `$ react-native link react-native-image-base64` 20 | 21 | ## Usage 22 | ```javascript 23 | import ImgToBase64 from 'react-native-image-base64'; 24 | 25 | ImgToBase64.getBase64String('file://youfileurl') 26 | .then(base64String => doSomethingWith(base64String)) 27 | .catch(err => doSomethingWith(err)); 28 | ``` 29 | 30 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | def safeExtGet(prop, fallback) { 2 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 3 | } 4 | 5 | buildscript { 6 | repositories { 7 | jcenter() 8 | google() 9 | maven { 10 | url 'https://maven.google.com' 11 | } 12 | } 13 | 14 | dependencies { 15 | classpath 'com.android.tools.build:gradle:3.0.0' 16 | } 17 | } 18 | 19 | apply plugin: 'com.android.library' 20 | 21 | android { 22 | compileSdkVersion safeExtGet('compileSdkVersion', 28) 23 | buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') 24 | defaultConfig { 25 | minSdkVersion safeExtGet('minSdkVersion', 16) 26 | targetSdkVersion safeExtGet('targetSdkVersion', 28) 27 | } 28 | lintOptions { 29 | abortOnError false 30 | } 31 | } 32 | 33 | repositories { 34 | mavenCentral() 35 | maven { 36 | url 'https://maven.google.com' 37 | } 38 | } 39 | 40 | dependencies { 41 | implementation 'com.facebook.react:react-native:+' 42 | } 43 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/src/main/java/fr/snapp/imagebase64/RNImgToBase64Module.java: -------------------------------------------------------------------------------- 1 | 2 | package fr.snapp.imagebase64; 3 | 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.net.Uri; 7 | import android.provider.MediaStore; 8 | import android.util.Base64; 9 | 10 | import java.io.ByteArrayOutputStream; 11 | import java.io.IOException; 12 | import java.io.InputStream; 13 | import java.net.HttpURLConnection; 14 | import java.net.URL; 15 | 16 | import com.facebook.react.bridge.ReactApplicationContext; 17 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 18 | import com.facebook.react.bridge.ReactMethod; 19 | import com.facebook.react.bridge.Promise; 20 | 21 | public class RNImgToBase64Module extends ReactContextBaseJavaModule { 22 | 23 | private final ReactApplicationContext reactContext; 24 | 25 | public RNImgToBase64Module(ReactApplicationContext reactContext) { 26 | super(reactContext); 27 | this.reactContext = reactContext; 28 | } 29 | 30 | @Override 31 | public String getName() { 32 | return "RNImgToBase64"; 33 | } 34 | 35 | @ReactMethod 36 | public void getBase64String(String uri, Promise promise) { 37 | Bitmap image = null; 38 | try { 39 | if (uri.contains("http")) { 40 | image = getBitmapFromURL(uri); 41 | } else { 42 | image = MediaStore.Images.Media.getBitmap(reactContext.getContentResolver(), Uri.parse(uri)); 43 | } 44 | if (image == null) { 45 | promise.reject("Error", "Failed to decode Bitmap, uri: " + uri); 46 | } else { 47 | promise.resolve(bitmapToBase64(image)); 48 | } 49 | } catch (Error e) { 50 | promise.reject("Error", "Failed to decode Bitmap: " + e); 51 | e.printStackTrace(); 52 | } catch (Exception e) { 53 | promise.reject("Error", "Exception: " + e); 54 | e.printStackTrace(); 55 | } 56 | } 57 | 58 | public Bitmap getBitmapFromURL(String src) { 59 | try { 60 | URL url = new URL(src); 61 | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 62 | connection.setDoInput(true); 63 | connection.connect(); 64 | InputStream input = connection.getInputStream(); 65 | Bitmap myBitmap = BitmapFactory.decodeStream(input); 66 | return myBitmap; 67 | } catch (IOException e) { 68 | e.printStackTrace(); 69 | return null; 70 | } 71 | } 72 | 73 | private String bitmapToBase64(Bitmap bitmap) { 74 | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); 75 | bitmap.compress(Bitmap.CompressFormat.JPEG, 80, byteArrayOutputStream); 76 | byte[] byteArray = byteArrayOutputStream.toByteArray(); 77 | return Base64.encodeToString(byteArray, Base64.DEFAULT); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /android/src/main/java/fr/snapp/imagebase64/RNImgToBase64Package.java: -------------------------------------------------------------------------------- 1 | 2 | package fr.snapp.imagebase64; 3 | 4 | import java.util.Arrays; 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.bridge.NativeModule; 10 | import com.facebook.react.bridge.ReactApplicationContext; 11 | import com.facebook.react.uimanager.ViewManager; 12 | import com.facebook.react.bridge.JavaScriptModule; 13 | 14 | public class RNImgToBase64Package implements ReactPackage { 15 | @Override 16 | public List createNativeModules(ReactApplicationContext reactContext) { 17 | return Arrays.asList(new RNImgToBase64Module(reactContext)); 18 | } 19 | 20 | public List> createJSModules() { 21 | return Collections.emptyList(); 22 | } 23 | 24 | @Override 25 | public List createViewManagers(ReactApplicationContext reactContext) { 26 | return Collections.emptyList(); 27 | } 28 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 2 | import { NativeModules } from 'react-native'; 3 | 4 | const { RNImgToBase64 } = NativeModules; 5 | 6 | export default RNImgToBase64; 7 | -------------------------------------------------------------------------------- /ios/RNImgToBase64.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include("RCTBridgeModule.h") 3 | #import "RCTBridgeModule.h" 4 | #else 5 | #import 6 | #endif 7 | 8 | @interface RNImgToBase64 : NSObject 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /ios/RNImgToBase64.m: -------------------------------------------------------------------------------- 1 | 2 | #import "RNImgToBase64.h" 3 | 4 | @implementation RNImgToBase64 5 | 6 | - (dispatch_queue_t)methodQueue 7 | { 8 | return dispatch_get_main_queue(); 9 | } 10 | RCT_EXPORT_MODULE() 11 | 12 | #pragma mark getBase64String 13 | RCT_EXPORT_METHOD(getBase64String:(NSURL*)url 14 | resolve:(RCTPromiseResolveBlock)resolve 15 | rejecter:(RCTPromiseRejectBlock)reject 16 | ) { 17 | dispatch_async(dispatch_queue_create("image_processing", 0), ^{ 18 | NSData* data = [NSData dataWithContentsOfURL:url]; 19 | dispatch_async(dispatch_get_main_queue(), ^{ 20 | resolve([data base64EncodedStringWithOptions:0]); 21 | }); 22 | }); 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ios/RNImgToBase64.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B3E7B58A1CC2AC0600A0062D /* RNImgToBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNImgToBase64.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = "include/$(PRODUCT_NAME)"; 18 | dstSubfolderSpec = 16; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 0; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 134814201AA4EA6300B7C361 /* libRNImgToBase64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNImgToBase64.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | B3E7B5881CC2AC0600A0062D /* RNImgToBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNImgToBase64.h; sourceTree = ""; }; 28 | B3E7B5891CC2AC0600A0062D /* RNImgToBase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNImgToBase64.m; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 134814211AA4EA7D00B7C361 /* Products */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 134814201AA4EA6300B7C361 /* libRNImgToBase64.a */, 46 | ); 47 | name = Products; 48 | sourceTree = ""; 49 | }; 50 | 58B511D21A9E6C8500147676 = { 51 | isa = PBXGroup; 52 | children = ( 53 | B3E7B5881CC2AC0600A0062D /* RNImgToBase64.h */, 54 | B3E7B5891CC2AC0600A0062D /* RNImgToBase64.m */, 55 | 134814211AA4EA7D00B7C361 /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | /* End PBXGroup section */ 60 | 61 | /* Begin PBXNativeTarget section */ 62 | 58B511DA1A9E6C8500147676 /* RNImgToBase64 */ = { 63 | isa = PBXNativeTarget; 64 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNImgToBase64" */; 65 | buildPhases = ( 66 | 58B511D71A9E6C8500147676 /* Sources */, 67 | 58B511D81A9E6C8500147676 /* Frameworks */, 68 | 58B511D91A9E6C8500147676 /* CopyFiles */, 69 | ); 70 | buildRules = ( 71 | ); 72 | dependencies = ( 73 | ); 74 | name = RNImgToBase64; 75 | productName = RCTDataManager; 76 | productReference = 134814201AA4EA6300B7C361 /* libRNImgToBase64.a */; 77 | productType = "com.apple.product-type.library.static"; 78 | }; 79 | /* End PBXNativeTarget section */ 80 | 81 | /* Begin PBXProject section */ 82 | 58B511D31A9E6C8500147676 /* Project object */ = { 83 | isa = PBXProject; 84 | attributes = { 85 | LastUpgradeCheck = 0610; 86 | ORGANIZATIONNAME = Facebook; 87 | TargetAttributes = { 88 | 58B511DA1A9E6C8500147676 = { 89 | CreatedOnToolsVersion = 6.1.1; 90 | }; 91 | }; 92 | }; 93 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNImgToBase64" */; 94 | compatibilityVersion = "Xcode 3.2"; 95 | developmentRegion = English; 96 | hasScannedForEncodings = 0; 97 | knownRegions = ( 98 | en, 99 | ); 100 | mainGroup = 58B511D21A9E6C8500147676; 101 | productRefGroup = 58B511D21A9E6C8500147676; 102 | projectDirPath = ""; 103 | projectRoot = ""; 104 | targets = ( 105 | 58B511DA1A9E6C8500147676 /* RNImgToBase64 */, 106 | ); 107 | }; 108 | /* End PBXProject section */ 109 | 110 | /* Begin PBXSourcesBuildPhase section */ 111 | 58B511D71A9E6C8500147676 /* Sources */ = { 112 | isa = PBXSourcesBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | B3E7B58A1CC2AC0600A0062D /* RNImgToBase64.m in Sources */, 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXSourcesBuildPhase section */ 120 | 121 | /* Begin XCBuildConfiguration section */ 122 | 58B511ED1A9E6C8500147676 /* Debug */ = { 123 | isa = XCBuildConfiguration; 124 | buildSettings = { 125 | ALWAYS_SEARCH_USER_PATHS = NO; 126 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 127 | CLANG_CXX_LIBRARY = "libc++"; 128 | CLANG_ENABLE_MODULES = YES; 129 | CLANG_ENABLE_OBJC_ARC = YES; 130 | CLANG_WARN_BOOL_CONVERSION = YES; 131 | CLANG_WARN_CONSTANT_CONVERSION = YES; 132 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 133 | CLANG_WARN_EMPTY_BODY = YES; 134 | CLANG_WARN_ENUM_CONVERSION = YES; 135 | CLANG_WARN_INT_CONVERSION = YES; 136 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 137 | CLANG_WARN_UNREACHABLE_CODE = YES; 138 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 139 | COPY_PHASE_STRIP = NO; 140 | ENABLE_STRICT_OBJC_MSGSEND = YES; 141 | GCC_C_LANGUAGE_STANDARD = gnu99; 142 | GCC_DYNAMIC_NO_PIC = NO; 143 | GCC_OPTIMIZATION_LEVEL = 0; 144 | GCC_PREPROCESSOR_DEFINITIONS = ( 145 | "DEBUG=1", 146 | "$(inherited)", 147 | ); 148 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 149 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 150 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 151 | GCC_WARN_UNDECLARED_SELECTOR = YES; 152 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 153 | GCC_WARN_UNUSED_FUNCTION = YES; 154 | GCC_WARN_UNUSED_VARIABLE = YES; 155 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 156 | MTL_ENABLE_DEBUG_INFO = YES; 157 | ONLY_ACTIVE_ARCH = YES; 158 | SDKROOT = iphoneos; 159 | }; 160 | name = Debug; 161 | }; 162 | 58B511EE1A9E6C8500147676 /* Release */ = { 163 | isa = XCBuildConfiguration; 164 | buildSettings = { 165 | ALWAYS_SEARCH_USER_PATHS = NO; 166 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 167 | CLANG_CXX_LIBRARY = "libc++"; 168 | CLANG_ENABLE_MODULES = YES; 169 | CLANG_ENABLE_OBJC_ARC = YES; 170 | CLANG_WARN_BOOL_CONVERSION = YES; 171 | CLANG_WARN_CONSTANT_CONVERSION = YES; 172 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 173 | CLANG_WARN_EMPTY_BODY = YES; 174 | CLANG_WARN_ENUM_CONVERSION = YES; 175 | CLANG_WARN_INT_CONVERSION = YES; 176 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 177 | CLANG_WARN_UNREACHABLE_CODE = YES; 178 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 179 | COPY_PHASE_STRIP = YES; 180 | ENABLE_NS_ASSERTIONS = NO; 181 | ENABLE_STRICT_OBJC_MSGSEND = YES; 182 | GCC_C_LANGUAGE_STANDARD = gnu99; 183 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 184 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 185 | GCC_WARN_UNDECLARED_SELECTOR = YES; 186 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 187 | GCC_WARN_UNUSED_FUNCTION = YES; 188 | GCC_WARN_UNUSED_VARIABLE = YES; 189 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 190 | MTL_ENABLE_DEBUG_INFO = NO; 191 | SDKROOT = iphoneos; 192 | VALIDATE_PRODUCT = YES; 193 | }; 194 | name = Release; 195 | }; 196 | 58B511F01A9E6C8500147676 /* Debug */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | HEADER_SEARCH_PATHS = ( 200 | "$(inherited)", 201 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 202 | "$(SRCROOT)/../../../React/**", 203 | "$(SRCROOT)/../../react-native/React/**", 204 | ); 205 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 206 | OTHER_LDFLAGS = "-ObjC"; 207 | PRODUCT_NAME = RNImgToBase64; 208 | SKIP_INSTALL = YES; 209 | }; 210 | name = Debug; 211 | }; 212 | 58B511F11A9E6C8500147676 /* Release */ = { 213 | isa = XCBuildConfiguration; 214 | buildSettings = { 215 | HEADER_SEARCH_PATHS = ( 216 | "$(inherited)", 217 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 218 | "$(SRCROOT)/../../../React/**", 219 | "$(SRCROOT)/../../react-native/React/**", 220 | ); 221 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 222 | OTHER_LDFLAGS = "-ObjC"; 223 | PRODUCT_NAME = RNImgToBase64; 224 | SKIP_INSTALL = YES; 225 | }; 226 | name = Release; 227 | }; 228 | /* End XCBuildConfiguration section */ 229 | 230 | /* Begin XCConfigurationList section */ 231 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNImgToBase64" */ = { 232 | isa = XCConfigurationList; 233 | buildConfigurations = ( 234 | 58B511ED1A9E6C8500147676 /* Debug */, 235 | 58B511EE1A9E6C8500147676 /* Release */, 236 | ); 237 | defaultConfigurationIsVisible = 0; 238 | defaultConfigurationName = Release; 239 | }; 240 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNImgToBase64" */ = { 241 | isa = XCConfigurationList; 242 | buildConfigurations = ( 243 | 58B511F01A9E6C8500147676 /* Debug */, 244 | 58B511F11A9E6C8500147676 /* Release */, 245 | ); 246 | defaultConfigurationIsVisible = 0; 247 | defaultConfigurationName = Release; 248 | }; 249 | /* End XCConfigurationList section */ 250 | }; 251 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 252 | } 253 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-image-base64", 3 | "version": "0.1.4", 4 | "description": "Convert image to base64", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "react-native", 11 | "base64" 12 | ], 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/Snapp-FidMe/react-native-img-to-base64" 16 | }, 17 | "author": "Snapp", 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /react-native-image-base64.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = package["name"] 7 | s.version = package["version"] 8 | s.summary = package["description"] 9 | s.homepage = "https://github.com/Snapp-FidMe/react-native-img-to-base64" 10 | s.license = package["license"] 11 | s.authors = package["author"] 12 | s.platform = :ios, "9.0" 13 | s.source = { :git => "#{s.homepage}", :tag => "V#{s.version}" } 14 | s.source_files = "ios/**/*.{h,m}" 15 | s.requires_arc = true 16 | s.dependency 'React' 17 | end --------------------------------------------------------------------------------