Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@hexagon/base64
Advanced tools
Base64 and base64url to string or arraybuffer, and back. Node, Deno or browser.
Probably the only JavaScript base64 library you'll ever need!
Encode, decode and validate base64/base64url to string/arraybuffer and vice-versa. Works in Node, Deno and browser.
// Encode string as regular base64
const example1enc = base64.fromString("Hellö Wörld, how are you doing today?!");
console.log(example1enc);
// > SGVsbMO2IFfDtnJsZCwgaG93IGFyZSB5b3UgZG9pbmcgdG9kYXk/IQ==
// Decode string as regular base64
const example1dec = base64.toString("SGVsbMO2IFfDtnJsZCwgaG93IGFyZSB5b3UgZG9pbmcgdG9kYXk/IQ==");
console.log(example1dec);
// > Hellö Wörld, how are you doing today?!
Full documentation available at base64.56k.guru
Node.js:
npm install @hexagon/base64 --save
Deno (x):
import { base64 } from "https://deno.land/x/b64@2.0.3/src/base64.ts";
Deno (jsr.io):
import { base64 } from "jsr:@hexagon/base64";
For browser/cdn usage, refer to the documentation.
fromArrayBuffer(buffer, urlMode) - Encodes ArrayBuffer
into base64 or base64url if urlMode(optional) is true
toArrayBuffer(str, urlMode) - Decodes base64url string (or base64url string if urlMode is true) to ArrayBuffer
fromString(str, urlMode) - Encodes String
into base64 string(base64url string if urlMode is true)
toString(str, urlMode) - Decodes base64 or base64url string to String
validate(str, urlMode) - Returns true if String
str is valid base64/base64 dependending on urlMode
If you found this library helpful and wish to support its development, consider making a donation through Hexagon's GitHub Sponsors page. Your generosity ensures the library's continued development and maintenance.
The underlying code is loosely based on github.com/niklasvh/base64-arraybuffer
MIT
FAQs
Base64 and base64url to string or arraybuffer, and back. Node, Deno or browser.
The npm package @hexagon/base64 receives a total of 106,132 weekly downloads. As such, @hexagon/base64 popularity was classified as popular.
We found that @hexagon/base64 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.