Skip to content

Instantly share code, notes, and snippets.

@aredridel
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aredridel/9106354 to your computer and use it in GitHub Desktop.
Save aredridel/9106354 to your computer and use it in GitHub Desktop.
Parsing data URL with ometajs
ometa DataUrl {
scheme = "data:",
type = /[a-z-]+/,
charset = /[a-z-]+/,
mimeType = type "/" type ( ";charset=" charset )?,
charset =
dataUrl = scheme mimeType base64? "," data
}
DataUrl.parse = function (str) {
return DataUrl.matchAll(str, 'dataUrl');
};
module.exports = DataUrl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment