New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@santi100/base64-lib

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@santi100/base64-lib

Santi's Base64 Library: A lightweight, portable, ES3-compliant Base64 library!

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Santi's Base64 Library

Build Status GitHub stars License npm bundle size

  • 🚀 Lightweight and fast^
  • 👴 ES3-compliant*
  • 💻 Portable between the browser and Node.js

What's this?

This is a lightweight, fast library for encoding and decoding strings in base64 format. It's portable between the browser and Node.js. In order to keep backwards compatibility with old browsers, this library can only encode and decode strings. This serves as a lighweight, portable replacement for the btoa and atob functions, and provides clearer names.

Contribute

Wanna contribute? File an issue or pull request! Make sure you follow the contribution Code of Conduct.

Installation

  • Via NPM: npm install @santi100/base64-lib
  • Via Yarn: yarn add @santi100/base64-lib
  • Via PNPM: pnpm install @santi100/base64-lib

API

  • function encode(input: string): string; Encodes input to base64 format. It takes a string as an argument, and returns a base64 representation of input.
  • function decode(input: string): string; Decodes input back to its original form. Must be a valid base64 string. It takes a valid base64 string, and returns the decoded value of input.

My Goals

The above functions must:

  1. Be able to handle strings that contain non-printable ASCII (the result of stringifying a buffer, for example).
  2. Be fully ES3 compliant (no ArrayBuffer, Uint8Array or anything like that).
  3. Use padding = signs.
  4. Be fully portable between the browser and Node.js (no reliance in any browser- or Node-exclusive API).
  5. Not modify the argument vector.

If any of the above is not being satisfied, open a pull request or issue. I have no idea how to satisfy idea #1 reliably (see Contribute (for instructions) and disclaimers😀).

Disclaimers

  • Keep in mind this library can only reliably handle plaintext for now.
  • *Hasn't been tested in an actual ES3 environment. Feel free to open an issue or pull request if you find any non-ES3 thing.
  • ^The source code is about 3 kilobytes.

Keywords

FAQs

Package last updated on 03 Mar 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc