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 🙏

© 2024 – Pkg Stats / Ryan Hefner

base64k

v1.0.2

Published

Base64 encode decode with key in pure javascript/typescript.

Downloads

19

Readme

Base64k

npm version build status License

Base64 encode decode with key in pure javascript/typescript.

Motivation

Many developers want to encode and decode base64 with privacy and don't want others to know of the many online base64 encode decode tools.

Features

  • Encode decode with key.
  • Dynamic Encode decode.
  • Normal Encode decode (without key).
  • Generate string random (bonus).

Installation

Using npm:

$ npm install base64k

Using yarn:

$ yarn add base64k

Usage

  1. initialize base64k

//es6 or ts
import base64k from "base64k";

//require
var base64k = require("base64k");

//browser
<script type="text/javascript" src="path/to/dist/base64k.min.js"></script>
  1. Encode and decode with key.
...

const text = "mysimpletest";
const key = "mykey";

const encode = base64k.encode(text, key);
console.log(encode);
//console.log : AAAYDBQdFQ4RHB4N

const decode = base64k.decode(encode, key);
console.log(decode);
//console.log : mysimpletest

...
  1. Dynamic encode and decode (generate random encode with the same string after decode.)
...

const text = "mysimpletest%&example";

const dyn_encode_1 = base64k.dynEncode(text);
const dyn_decode_1 = base64k.dynDecode(dyn_encode_1);
console.log(dyn_encode_1, " => ", dyn_decode_1);
//console.log : KSglDxc4Iw01Hzclc0AfMC4FMRYh@DQVfzHOhAz  =>  mysimpletest%&example

const dyn_encode_2 = base64k.dynEncode(text);
const dyn_decode_2 = base64k.dynDecode(dyn_encode_2);
console.log(dyn_encode_2, " => ", dyn_decode_2);
//console.log : ITc7AQsXNgIdDz86bU4DHzsKGQYp@LNHhfgZgij  =>  mysimpletest%&example

const dyn_encode_3 = base64k.dynEncode(text);
const dyn_decode_3 = base64k.dynDecode(dyn_encode_3);
console.log(dyn_encode_3, " => ", dyn_decode_3);
//console.log : GgkAADsgCDYAPAQEVk8zKAU+BDUS@wpsiVPdStY  =>  mysimpletest%&example

...
  1. Normal encode and decode base64 (without key).
...

const text = "mysimpletest";

const encode = base64k.encode(text);
console.log(encode);
//console.log : bXlzaW1wbGV0ZXN0

const decode = base64k.decode(encode);
console.log(decode);
//console.log : mysimpletest

...
  1. Generate random string key (bonus).
...
//random string with combination abjad and number.
const test1 = base64k.genKey(); 
//console.log : LKgX4JRN4G

//random string with length 20 and combination abjad and number.
const test2 = base64k.genKey(20); 
//console.log : A5upjvtz40jv71CIBNDw

//random string with length 20 and only abjad.
const test3 = base64k.genKey(20, "a"); 
//console.log : VsjnmnmimWYZgeohNKAa

//random string with length 20 and only number.
const test4 = base64k.genKey(20, "n"); 
//console.log : 36380839173686148035

...

From Source

Base64k is available for further development. made with typescript.


//clone project
git clone https://github.com/herudi/base64k.git
cd base64k

//for build
npm run build

//for test
npm run test

Contact me : [email protected]

License

MIT