Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
toBase64() {
return Base64.btoa(this._binaryString);
}
`firebase.storage.StorageReference.putString(_, *, _) 'format' provided is invalid, must be one of ${Object.values(
StorageStatics.StringFormat,
).join(',')}.`,
);
}
if (!isUndefined(metadata)) {
validateMetadata(metadata);
}
let _string = string;
let _format = format;
let _metadata = metadata;
if (format === StorageStatics.StringFormat.RAW) {
_string = Base64.btoa(_string);
_format = StorageStatics.StringFormat.BASE64;
} else if (format === StorageStatics.StringFormat.DATA_URL) {
const { mediaType, base64String } = getDataUrlParts(_string);
if (isUndefined(base64String)) {
throw new Error(
'firebase.storage.StorageReference.putString(*, _, _) invalid data_url string provided.',
);
}
if (isUndefined(metadata) || isUndefined(metadata.contentType)) {
if (isUndefined(metadata)) {
_metadata = {};
}
_metadata.contentType = mediaType;
_string = base64String;
_format = StorageStatics.StringFormat.BASE64;