Code Monkey home page Code Monkey logo

ab64's Introduction

ab64

GitHub Actions Codecov Language grade: JavaScript type-coverage npm GitHub Release

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier changesets

The smallest and fastest Base64 implementation in JavaScript based on atob and btoa from browser native or Buffer from node

TOC

Usage

Install

# pnpm
pnpm add ab64

# yarn
yarn add ab64

# npm
npm i ab64

API

Basic

import { decode, decodeUrl, encode, encodeUrl } from 'ab64'

encode('Hello World!') // SGVsbG8gV29ybGQh

encode('dankogai') // ZGFua29nYWk=
encodeUrl('dankogai') // ZGFua29nYWk

encode('小飼弾') // 5bCP6aO85by+
encodeUrl('小飼弾') // 5bCP6aO85by-

decode('SGVsbG8gV29ybGQh') // Hello World!

decode('ZGFua29nYWk=') // dankogai
decodeUrl('ZGFua29nYWk') // dankogai

decode('5bCP6aO85by+') // 小飼弾
decodeUrl('5bCP6aO85by-') // 小飼弾

Polyfill

If you're running on a non Node environment where atob and btoa could be unavailable, you may want to include the polyfill manually

import 'ab64/polyfill'

// same as above then

Ponyfill

atob and btoa are also available exported as ab64/ponyfill which does not polyfill by default

import { atob, btoa } from 'ab64/ponyfill'

// same as browser native

MiniApp (WeChat)

Since mini app (from wechat) does not support global polyfill, so you have to use the separate mini-app entry instead which uses the above ponyfill inside

import { decode, decodeUrl, encode, encodeUrl } from 'ab64/mini-app'

Or you should add an alias mapping ab64 to ab64/mini-app in your rollup/vite/webpack configuration

Sponsors

1stG RxTS UnTS
1stG Open Collective backers and sponsors RxTS Open Collective backers and sponsors UnTS Open Collective backers and sponsors

Backers

1stG RxTS UnTS
1stG Open Collective backers and sponsors RxTS Open Collective backers and sponsors UnTS Open Collective backers and sponsors

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT © JounQin@1stG.me

ab64's People

Contributors

github-actions[bot] avatar jounqin avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ab64's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @changesets/changelog-github to ^0.5.0
  • chore(deps): update dependency typescript to ~4.9.5
  • chore(deps): update dependency unplugin-auto-import to ^0.18.2
  • chore(deps): update pnpm to v7.33.7
  • chore(deps): update react monorepo (@types/react, @types/react-dom, react, react-dom)
  • chore(deps): update vitest monorepo to ^0.34.6 (@vitest/coverage-istanbul, vitest)
  • fix(deps): update dependency tslib to ^2.6.3
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update codecov/codecov-action action to v4
  • chore(deps): update dependency @1stg/app-config to v10
  • chore(deps): update dependency @1stg/lib-config to v13
  • chore(deps): update dependency @size-limit/preset-small-lib to v11
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency edge-runtime to v3
  • chore(deps): update dependency size-limit to v11
  • chore(deps): update dependency tsx to v4
  • chore(deps): update dependency typescript to v5
  • chore(deps): update github/codeql-action action to v3
  • chore(deps): update pnpm to v9
  • chore(deps): update vitest monorepo to v2 (major) (@vitest/coverage-istanbul, vitest)
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • codecov/codecov-action v3
.github/workflows/codeql.yml
  • actions/checkout v3
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/pages.yml
  • actions/checkout v3
  • actions/setup-node v3
  • JamesIves/github-pages-deploy-action v4
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/size-limit.yml
  • actions/checkout v3
  • actions/setup-node v3
  • andresz1/size-limit-action v1
.github/workflows/vercel.yml
  • actions/checkout v3
  • amondnet/vercel-action v25
npm
docs/package.json
package.json
  • tslib ^2.4.0
  • @1stg/app-config ^7.3.0
  • @1stg/lib-config ^10.3.0
  • @changesets/changelog-github ^0.4.8
  • @changesets/cli ^2.24.4
  • @pkgr/webpack ^3.4.0
  • @pkgr/webpack-mdx ^2.2.0
  • @size-limit/preset-small-lib ^8.1.2
  • @types/mdx ^2.0.3
  • @types/node ^18.7.23
  • @types/react ^18.0.27
  • @types/react-dom ^18.0.10
  • @types/web ^0.0.93
  • @vitest/coverage-istanbul ^0.23.4
  • cross-env ^7.0.3
  • edge-runtime 1.1.0
  • github-markdown-css ^5.1.0
  • react ^18.2.0
  • react-dom ^18.2.0
  • react-router-dom ^6.4.1
  • sirv-cli ^2.0.2
  • size-limit ^8.1.0
  • tsx ^3.9.0
  • type-coverage ^2.22.0
  • typescript ~4.8.4
  • unplugin-auto-import ^0.11.2
  • vitest ^0.23.4
  • node ^12.20.0 || ^14.18.0 || >=16.0.0
  • pnpm 7.12.2
nvm
.nvmrc

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.