@b613/utils
Advanced tools
Comparing version 1.0.0-alpha7 to 1.0.0-alpha8
import { __awaiter } from "tslib"; | ||
export { base64MimeType } from './common'; | ||
const EventOptions = { | ||
once: true, | ||
}; | ||
const REGEX = /^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+);base64,(.+)/; | ||
export function base64MimeType(encoded) { | ||
if (typeof encoded !== 'string') { | ||
return null; | ||
} | ||
const matches = encoded.match(REGEX); | ||
if (matches === null || matches === void 0 ? void 0 : matches.length) { | ||
return { | ||
mime: matches[1], | ||
data: encoded, | ||
raw: matches[2], | ||
}; | ||
} | ||
return null; | ||
} | ||
/** | ||
@@ -7,0 +21,0 @@ * Compress an input image's dataurl with resizing & image quality compression |
@@ -8,5 +8,19 @@ "use strict"; | ||
const jimp_1 = tslib_1.__importDefault(require("jimp")); | ||
var common_1 = require("./common"); | ||
Object.defineProperty(exports, "base64MimeType", { enumerable: true, get: function () { return common_1.base64MimeType; } }); | ||
const download = require('image-downloader'); | ||
const REGEX = /^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+);base64,(.+)/; | ||
function base64MimeType(encoded) { | ||
if (typeof encoded !== 'string') { | ||
return null; | ||
} | ||
const matches = encoded.match(REGEX); | ||
if (matches === null || matches === void 0 ? void 0 : matches.length) { | ||
return { | ||
mime: matches[1], | ||
data: encoded, | ||
raw: matches[2], | ||
}; | ||
} | ||
return null; | ||
} | ||
exports.base64MimeType = base64MimeType; | ||
function parseBase64(imageUrl, resizeWidth) { | ||
@@ -13,0 +27,0 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () { |
{ | ||
"name": "@b613/utils", | ||
"version": "1.0.0-alpha7", | ||
"version": "1.0.0-alpha8", | ||
"description": "Set of utility methods for common operations", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114940
1995
55