New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

blast64

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blast64

An apparently even faster in-browser base64 decoder

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

⚡️ blast64

Apparently the fastest way of decoding Base64 in Chrome.

Installation

npm install blast64

Usage

var blast64 = require('blast64');

// From base64 to UTF-8 string
blast64.decode(base64string);

// From base64 to Uint8Array
blast64.decode_to_array(base64string);

Testing and Benchmark

This is the average time from encoded string to UTF-8 encoded result.

The 💓 was ran 10000000 times.

The ~355kb payload was ran 1000 times.

Loadatob+TextDecoderjs-base64fast64base64-jsblast64
💓0.0019 ms0.0025 ms0.0031 ms0.0018 ms0.0010 ms
~355kb31.257 ms4.5263 ms2.9529 ms1.7501 ms1.3920 ms

And this are the average times without the TextDecoder step where relevant:

Loadfast64[0]atobblast64.decode_to_array
💓0.0017 ms0.0008 ms0.0005 ms
~355kb2.5336 ms1.7580 ms1.0701 ms

[0] fast64.decode(str, {uint8Array: true})

Not bad for a few hours of hacking I'd say! But it's still only decoding, would have to sit down and make it encode as well at some point.

Keywords

browser

FAQs

Package last updated on 24 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts