Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Changelog
v3.0.0
Readme
A tiny, lightweight module for encoding and decoding Base64 URLs (RFC 4648). Supports TypeScript, but also works without it.
NOTE: if you were previously using the unmaintained base64url
package, this library is API-identical.
Install via yarn:
yarn add b64u
Or via NPM:
npm install --save b64u
import b64u from 'b64u'
b64u('A tiny, lightweight module')
// 'QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU'
b64u.encode('A tiny, lightweight module')
// 'QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU'
b64u.decode('Zm9yIGVuY29kaW5nIGFuZCBkZWNvZGluZyBCYXNlNjQgVVJMcw')
// 'for encoding and decoding Base64 URLs'
b64u.toBase64('QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU')
// 'QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU='
b64u.fromBase64('QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU=')
// 'QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU'
b64u.toBuffer(b64u('tiny'))
// <Buffer 74 69 6e 79>
Either require or import the library:
const b64u = require('b64u')
import b64u from 'b64u'
Encodes an input
string or buffer into a Base64 URL. Optionally specify an encoding
.
Example
b64u('A tiny, lightweight module')
// 'QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU'
b64u.encode('A tiny, lightweight module')
// 'QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU'
Decodes an input
Base64 URL into a raw string. Optionally specify an encoding
.
Example
b64u.decode('Zm9yIGVuY29kaW5nIGFuZCBkZWNvZGluZyBCYXNlNjQgVVJMcw')
// 'for encoding and decoding Base64 URLs'
Converts an input
Base64 URL into a plain Base64 string.
Example
b64u.toBase64('QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU')
// 'QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU='
Converts an input
plain Base64 string into a Base64 URL.
Example
b64u.fromBase64('QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU=')
// 'QSB0aW55LCBsaWdodHdlaWdodCBtb2R1bGU'
Converts an input
Base64 URL into a Buffer with the raw bytes.
Example
b64u.toBuffer(b64u('tiny'))
// <Buffer 74 69 6e 79>
This library began as an API-identical fork of the base64url
package, as that package has not been updated since 2016 and currently suffers from a critical issue that prevents its use with TypeScript and any version of NodeJS other than Node 6.0.0.
Why the name, b64u
? It's a tiny, lightweight name for a tiny, lightweight module!
The MIT license. See LICENSE
.
Copyright (c) 2018 Jacob Gillespie
Copyright (c) 2013–2016 Brian J. Brennan
FAQs
Tiny, lightweight module for encoding and decoding Base64 URLs
The npm package b64u receives a total of 5,956 weekly downloads. As such, b64u popularity was classified as popular.
We found that b64u demonstrated a not healthy version release cadence and project activity because the last version was released 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.