Skip to content

migueldaipre/react-native-quick-base64

 
 

Repository files navigation

react-native-quick-base64

A native implementation of Base64 in C++ for React Native.

~16x faster than base64-js on an iPhone 15 Pro Max simulator. Try the benchmarks under example.

iPhone Android
iPhone Android

Installation

npm install react-native-quick-base64

Usage

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

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

Methods

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

shim()

Adds btoa and atob functions to global.

Contributing

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

License

MIT by Takuya Matsuyama

About

A fast base64 module for React Native

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 44.3%
  • C++ 27.1%
  • Ruby 5.5%
  • Kotlin 5.0%
  • JavaScript 4.9%
  • Objective-C 4.4%
  • Other 8.8%