From cb771d9a6787ebb8375e9bc866199d49dd386f2e Mon Sep 17 00:00:00 2001 From: Hexagon Date: Sun, 3 Apr 2022 21:30:55 +0200 Subject: [PATCH] Update docs --- docs/base64.js.html | 10 ++++++---- docs/index.html | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/base64.js.html b/docs/base64.js.html index 7804acb..22d4da7 100644 --- a/docs/base64.js.html +++ b/docs/base64.js.html @@ -124,13 +124,13 @@

/* ------------------------------------------------------------------------------------
 
-  base64 - MIT License - Hexagon <github.com/Hexagon>
+  base64 - MIT License - Hexagon <hexagon@56k.guru>
 
   ------------------------------------------------------------------------------------
 
   License:
 
-	Copyright (c) 2021 Hexagon <github.com/Hexagon>
+	Copyright (c) 2021 Hexagon <hexagon@56k.guru>
 
 	Permission is hereby granted, free of charge, to any person obtaining a copy
 	of this software and associated documentation files (the "Software"), to deal
@@ -252,10 +252,11 @@ 

* @public * * @param {string} str - Base64 encoded string to be decoded + * @param {boolean} [urlMode] - If set to true, URL mode string will be expected * @returns {string} - Decoded string */ base64.toString = (str, urlMode) => { - return Buffer.from(base64.toArrayBuffer(str, urlMode)).toString(); + return new TextDecoder().decode(base64.toArrayBuffer(str, urlMode)); }; /** @@ -263,10 +264,11 @@

* @public * * @param {string} str - String to be converted to base64 + * @param {boolean} [urlMode] - If set to true, URL mode string will be returned * @returns {string} - Base64 encoded string */ base64.fromString = (str, urlMode) => { - return base64.fromArrayBuffer(Buffer.from(str), urlMode); + return base64.fromArrayBuffer(new TextEncoder().encode(str), urlMode); }; export default base64; diff --git a/docs/index.html b/docs/index.html index 7cb1b2f..1bb05ee 100644 --- a/docs/index.html +++ b/docs/index.html @@ -130,8 +130,8 @@

@hexagon/base64

Base64 and base64url to string or arraybuffer, and back. Works in Node, Deno or browser.

Node.js CI -npm version NPM Downloads Codacy Badge -MIT License jsdelivr

+npm version NPM Downloads jsdelivr Codacy Badge +MIT License

  • Supports regular base64, as well as base64url
  • Convert to/from string or arraybuffer