npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ab2b64

v0.9.1

Published

Convert ArrayBuffer to Base64 string and vice versa

Downloads

36

Readme

Array Buffer to Base64 Encoding Build Status

JavaScript Library to convert Array Buffer to Base64 encoded string and vice versa. This library is an useful add-on for cryptographic project, network project, and more.
There is no dependency for this project, and it works in both Node and Browser environment.

Node.js (Install)

Requirements:

  • Node.js (version 8 or above. Need ES6 async/await and typed array)
  • NPM
npm install ab2b64

Usage

    const ab2b64 = require("ab2b64");
    //Converting Array Buffer to Base64 String - Synchronous method
    let Base64String = ab2b64.ab2b64(buffer);
    
    //Converting Base64 String to Array Buffer - Synchronous method
    let buffer = ab2b64.b642ab(Base64String);
    
    //Converting Array Buffer to Base64 String - Asynchronous method
    let Base64String = await ab2b64.ab2b64Async(buffer);
        
    //Converting Base64 String to Array Buffer - Asynchronous method
    let buffer = await ab2b64.b642abAsync(Base64String);

Q&A

Q: Why this library needs node version 8 or above?

A: Specifically, this library requires async/await and typed array feature from ES2015. Any node or browser version supporting these two will suffice. Async/await is much less important as it only served as wrapper for async call. You can fork your own on github and rewrite the async/await portion.
However, the typed array feature is a must as typed array is used heavily.

Q: Why not just use the Base64 conversion feature in more established library, like Crypto-JS?

A: As of the writing of this library, I can't find one on NPM that converts Array Buffer to Base64. Crypto-JS converts specialized 'Word Array', not Array Buffer.

Q: Your library is garbage! I don't like it!

A: Then you open PR and improve it! Or don't use it! Nobody is begging you here...
Look, I get it. This library isn't super optimized. It is optimized enough for my project, and I published this on NPM so others may take advantage of my works.
I know some people (like those working in G-Company) love writing highly optimized but long and cryptic codes without documentation.
I prefer codes that can be easily and quickly understood by teammate of different experience levels so they can contribute quickly.