A fast base64 module for React Native



A native implementation of Base64 in C++ for React Native. 4x faster than base64-js on an iPhone 11 Pro. Try the benchmarks under example.


npm install react-native-quick-base64


import { btoa, atob } from 'react-native-quick-base64';

const base64 = btoa('foo');
const decoded = atob(base64);


Compatible with base64-js.

byteLength(b64: string): number

Takes a base64 string and returns length of byte array

toByteArray(b64: string): Uint8Array

Takes a base64 string and returns a byte array

fromByteArray(uint8: Uint8Array): string

Takes a byte array and returns a base64 string

btoa(data: string): string

Encodes a string in base64

atob(b64: string): string

Decodes a base64 encoded string


Adds btoa and atob functions to global.


See the contributing guide to learn how to contribute to the repository and the development workflow.



  • Crashes on Android Start up sometimes on release build

    Crashes on Android Start up sometimes on release build

    Hello! Thank you for building this awesome library.

    I'm using this library in my application, and it's working fine on iOS, but it sometimes crashes on startup of my app for android release build.

    Is this a known problem?

    Here's the stack trace of the crash, hope it helps.

          #00 pc 000000000005ba2c  /data/app/~~yY065jv4ZakTKp3V_fMcsw==/com.masked-WePDD3HBan4olArPBJi-QQ==/lib/arm64/libhermes.so (BuildId: a3c1bac83dd7ae8092428d75091c23ae6f8c69c7)
          #01 pc 000000000006e0e8  /data/app/~~yY065jv4ZakTKp3V_fMcsw==/com.masked-WePDD3HBan4olArPBJi-QQ==/lib/arm64/libhermes.so (BuildId: a3c1bac83dd7ae8092428d75091c23ae6f8c69c7)
          #02 pc 00000000000709f0  /data/app/~~yY065jv4ZakTKp3V_fMcsw==/com.masked-WePDD3HBan4olArPBJi-QQ==/lib/arm64/libhermes.so (BuildId: a3c1bac83dd7ae8092428d75091c23ae6f8c69c7)
          #03 pc 00000000000342a0  /data/app/~~yY065jv4ZakTKp3V_fMcsw==/com.masked-WePDD3HBan4olArPBJi-QQ==/lib/arm64/libhermes.so (facebook::hermes::HermesRuntimeImpl::setPropertyValue(facebook::jsi::Object&, facebook::jsi::String const&, facebook::jsi::Value const&)+128) (BuildId: a3c1bac83dd7ae8092428d75091c23ae6f8c69c7)
          #04 pc 000000000004df94  /data/app/~~yY065jv4ZakTKp3V_fMcsw==/com.masked-WePDD3HBan4olArPBJi-QQ==/lib/arm64/libquickbase64.so (void facebook::jsi::Object::setProperty<facebook::jsi::Function>(facebook::jsi::Runtime&, char const*, facebook::jsi::Function&&)+144) (BuildId: 54db5574dbb5bdf19ead7da238493e90a842cd9b)
          #05 pc 000000000004dbec  /data/app/~~yY065jv4ZakTKp3V_fMcsw==/com.masked-WePDD3HBan4olArPBJi-QQ==/lib/arm64/libquickbase64.so (installBase64(facebook::jsi::Runtime&)+332) (BuildId: 54db5574dbb5bdf19ead7da238493e90a842cd9b)
          #06 pc 000000000004ee10  /data/app/~~yY065jv4ZakTKp3V_fMcsw==/com.masked-WePDD3HBan4olArPBJi-QQ==/lib/arm64/libquickbase64.so (Java_com_reactnativequickbase64_QuickBase64Module_initialize+32) (BuildId: 54db5574dbb5bdf19ead7da238493e90a842cd9b)

    React Native ver: 0.65.1 react-native-quick-base64 ver: 0.1.4 jsruntime: hermes

    opened by Naturalclar 19
  • With version  2.0.2 getting react-native-quick-base64:generateJsonModelDebug error

    With version 2.0.2 getting react-native-quick-base64:generateJsonModelDebug error


    with the update 2.0.2 android build is failing with the following error. Can you please check

    Execution failed for task ':react-native-quick-base64:generateJsonModelDebug'.

    C:\Users\aj\work\node_modules\react-native-quick-base64\android\CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Error at C:\Users\aj\work\node_modules\react-native-quick-base64\android\CMakeLists.txt:14 (add_library): Syntax error in cmake code when parsing string

    Invalid character escape '\U'.
    opened by activexJ 3
  • Support encodes base64url

    Support encodes base64url


    I'm looking for a solution encodes base64 to base64url without using javascript replace. Can you add a feature for encodes base64url or is there a solution for me?

    opened by nanthawat 2
  • feat(android): autoinstall

    feat(android): autoinstall

    I saw @mrousavy made his module able to auto-install:


    • It automatically initializes the native module on Android while avoiding the race condition crash issue mentioned in #2.

    • BREAKING CHANGE: Remove the manual installation from your Android app

    opened by craftzdog 2
  •  react-native-quick-base64 2.0.2 build error

    react-native-quick-base64 2.0.2 build error

    Could not determine the dependencies of task ':react-native-quick-base64:mergeDebugNativeLibs'.

    No version of NDK matched the requested version 21.4.7075529. Versions available locally: 20.1.5948944

    opened by xieyimaple 1
  • Search node_modules recursively

    Search node_modules recursively

    Hello Takuya, Thanks for the library. We're using it in a monorepo setup. So, we need to search for node_modules in root directory.

    I've added (copy/pasted 😆) the below approach from react-native-mmkv by marc.

    Let me know if any changes are required. Also, love your videos ❤️

    opened by intergalacticspacehighway 1
  • fix: Initialize QuickBase64 on JS Thread (Android)

    fix: Initialize QuickBase64 on JS Thread (Android)

    Initializes QuickBase64 on the JS-Thread to avoid any race condition or invalid access.

    This also means that the user has to manually edit some native Java files to correctly install QuickBase64...

    opened by mrousavy 0
  • CMake blocking in build on RN 0.70

    CMake blocking in build on RN 0.70

    hello, On RN 0.70.4 with this module , build on Window is blocking .

    error message : > Task :react-native-quick-base64:buildCMakeDebug[armeabi-v7a] FAILED C/C++: ninja: error: mkdir(CMakeFiles/quickbase64.dir/myprojectpath): No such file or directory

    opened by Productivix 2
  • Port WebKit's base64 implementation to improve performance

    Port WebKit's base64 implementation to improve performance

    It uses a lookup table https://github.com/WebKit/WebKit/blob/main/Source/WTF/wtf/text/Base64.cpp

    ref: https://github.com/margelo/react-native-quick-crypto/issues/18

    opened by craftzdog 1
  • toBase64 results differ from js-base64

    toBase64 results differ from js-base64

    I have run the same byte arrays through js-base64 and cpp64 with those results:

     LOG  [82, 235, 19, 104, 164, 2, 214, 83, 201, 109, 220, 113, 198, 127, 246, 41, 43, 88, 224, 70, 83, 8, 70, 37, 84, 13, 192, 247, 128, 225, 4, 94]
     LOG  cpp64: UusTaKQC1lPJbdxxxn/2KStY4EZTCEYlVA3A94DhBF4=
     LOG  jsb64: UusTaKQC1lPJbdxxxn/2KStY4EZTCEYlVA3A94DhBF4=
     LOG  [11, 80, 135, 209, 171, 28, 64, 255, 39, 210, 24, 201, 226, 41, 153, 223, 120, 249, 81, 218, 135, 69, 207, 111]
     LOG  cpp64: C1CH0ascQP8n0hjJ4imZ33j5UdqHRc9v
     LOG  jsb64: C1CH0ascQP8n0hjJ4imZ33j5UdqHRc9v
     LOG  [184, 179, 212, 210, 19, 142, 29, 203, 166, 118, 216, 245, 113, 162, 222, 115]
     LOG  jsb64: uLPU0hOOHcumdtj1caLecw==

    The A padding on the last tuple is wrong..

    Any idea what could be wrong?

    opened by pke 13
Takuya Matsuyama
Digital craftsman ╥━━━━━━━━╭━━╮━━┳ ╢╭╮╭━━━━━┫┃▋▋━▅┣ ╢┃╰┫┈┈┈┈┈┃┃┈┈╰┫┣ ╢╰━┫┈┈┈┈┈╰╯╰┳━╯┣ ╢┊┊┃┏┳┳━━┓┏┳┫┊┊┣ ╨━━┗┛┗┛━━┗┛┗┛━━┻
Takuya Matsuyama
A framework for building native Windows apps with React.

React Native for Windows Build native Windows apps with React. See the official React Native website for an introduction to React Native. React Native

Microsoft 15.1k Nov 26, 2022
A contacts library for React Native using JSI

react-native-jsi-contacts The current react-native-contacts library uses the React Native Bridge to convert the native Java/Objective-C types to JavaS

Marc Rousavy 139 Oct 27, 2022
React-Native build of Hyperswarm and dependencies

Testing Hyperbeam Start hyperbeam on your computer and copy-paste address to packages/mobile/App.tsx. Then in another terminal run yarn mobile:start a

Tomas Ravinskas 5 Sep 5, 2022
A React Native library for accessing an ArrayBuffer of a Blob instance.

react-native-blob-jsi-helper A React Native library for directly accessing an ArrayBuffer of a Blob instance. Note: This is a workaround. A long-term

Marc Rousavy 82 Nov 17, 2022
React Native polyfill for crypto.getRandomValues. Used in libraries like uuid.

react-native-random-values-jsi-helper React Native polyfill for crypto.getRandomValues. Used in libraries like uuid. Installation yarn add react-nativ

Matei Oprea 30 Oct 30, 2022
A step by step example of creating your own React Native TurboModule.

Discovering Turbo Modules Note: This example was made in RN 0.63. Some things have changed since then, but the good news is that now the setup should

Bartłomiej Klocek 95 Nov 14, 2022
An easy to decode base64 modification.

crzy64 An easy to decode base64 modification. This is a base64 modification designed to simplify the decoding step. For the four encoded bytes, it onl

Ilya Kurdyukov 36 Jun 20, 2022
base64 single header encode/decode

b64.h base64 single header encode/decode #include <stdio.h> #include "b64.h" // strings are stored on the heap, don't forget to free() them int main(i

null 4 Jul 27, 2022
C library containing useful base64 related functions.

b64 C library containing useful fast base64 related functions. Usage Get the library: It's very simple to use it, run the "build_lib.sh" shell script

null 5 May 8, 2022
Plays native alert sound and shows native dialogs/alerts in your Flutter app.

flutter_platform_alert 2021 © Weizhong Yang a.k.a zonble. A simple plugin to present native alerts, including playing alert sounds and showing alert d

Weizhong Yang a.k.a zonble 58 Oct 31, 2022
Visual Studio native debugger extension to help debug native applications using Mono.

Unity Mixed Callstack UnityMixedCallstack is a Visual Studio 2017/2019 extension to help debug native applications embedding Mono, like Unity. If you

Unity Technologies 83 Nov 28, 2022
Projeto pessoal: Obter a temperatura ambiente e através de um termistor ligado a um arduino e disponibilizar esses dados em tempo real via API NodeJS. No front-end os dados são acessados por uma interface em React JS.

INTEGRAÇÃO DA API COM OS DADOS DO ARDUINO FORNECIDOS PELO TERMISTOR Código Desenvolvido por Lucas Muffato. MATERIAIS 1 Placa de Arduino; 1 Cabo de con

Lucas Muffato 35 Aug 16, 2022
C++React: A reactive programming library for C++11.

C++React is reactive programming library for C++14. It enables the declarative definition of data dependencies between state and event flows. Based on

Sebastian 966 Nov 27, 2022
Jimp-native is a fast C++ re-implementation of Jimp with zero system dependencies and minimal overhead!

Jimp native Make your sever-side Jimp code run 10x faster! Jimp-native is a fast C++ re-implementation of Jimp with zero system dependencies and minim

Sjoerd 17 Oct 10, 2022
Peregrine - A blazing fast language for the blazing fast world(WIP)

A Blazing-Fast Language for the Blazing-Fast world. The Peregrine Programming Language Peregrine is a Compiled, Systems Programming Language, currentl

Peregrine 1.5k Nov 29, 2022
A Dart package to send native 💬 toasts on Windows. Based on WinToast.

desktoasts A Dart package to send native ?? toasts on Windows. Installation For Flutter dependencies: ... desktoasts: ^0.0.2 For Dart CLI here Sup

Hitesh Kumar Saini 37 Mar 7, 2022
Haxe native extension to read and write windows clipboard.

Haxe Clipboard This is a native library to read and write clipboard data from Haxe. It uses Ammer to generate bindings. Note: This is a Windows only l

Ludovic Bas 12 Nov 11, 2022
Sloth 🦥 is a coverage guided fuzzing framework for fuzzing Android Native libraries that makes use of libFuzzer and QEMU user-mode emulation

Sloth ?? Sloth is a fuzzing setup that makes use of libFuzzer and QEMU’s user-mode emulation (qemu/linux-user) on x86_64/aarch64 host to emulate aarch

Chaithu 82 Nov 3, 2022
Björn Kalkbrenner 36 Oct 10, 2022