dankogai / js-base64

Base64 implementation for JavaScript
BSD 3-Clause "New" or "Revised" License
4.27k stars 1.33k forks source link

有没有方法可以准确判断是否是base64格式的 #178

Closed ytanck closed 1 month ago

ytanck commented 3 months ago

比如MTMzNjY2Njg4ODg 和 MTMzNjY2Njg4ODg= 后面多了个‘=’,但都可以base64解码成功。但有些方法判断 isBase64('MTMzNjY2Njg4ODg')返回false

zicz commented 1 month ago

base64 的长度不是 4 的倍数,需要在末尾添加“=”

The length of base64 is not a multiple of 4, and '=' needs to be added at the end。

dankogai commented 1 month ago

Sorry for overlooking this issue.

This module does not have isBase64(). It does have isValid() instead.