JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 485146
  • Score
    100M100P100Q167664F
  • License MIT

Predicate that returns true if base64 string.

Package Exports

  • is-base64

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-base64) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-base64

Predicate that returns true if base64 string.

NPM

Install

npm install is-base64

Usage

var isBase64 = require('is-base64');

var string = 'iVBORw0KGgoAAAAN ... kSuQmCC';
var stringWithMime = 'data:image/png;base64,iVBORw0KGgoAAAA ... AAElFTkSuQmCC';

console.log(isBase64(string)); // true
console.log(isBase64(stringWithMime)); // true
console.log(isBase64('1342234')); // false
console.log(isBase64('afQ$%rfew')); // false
console.log(isBase64('dfasdfr342')); // false
console.log(isBase64('uuLMhh==')); // true
console.log(isBase64('uuLMhh')); // false
console.log(isBase64('uuLMhh', {paddingRequired: false})); // true

API

isBase64(string, options)

  • {string} string - string to check if is valid base64 string

  • {object} [options]

    • [options.paddingRequired=true] {boolean} - check for padding

License

MIT