Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
const result: GitHubBlob = await this.request(`${repoURL}/git/blobs/${sha}`);
if (parseText) {
// treat content as a utf-8 string
const content = Base64.decode(result.content);
return content;
} else {
// treat content as binary and convert to blob
const content = Base64.atob(result.content);
const byteArray = new Uint8Array(content.length);
for (let i = 0; i < content.length; i++) {
byteArray[i] = content.charCodeAt(i);
}
const blob = new Blob([byteArray]);
return blob;
}
}
const nativeToJSON = value => {
const binary = Base64.atob(value);
const modifiedBinaryString = binary
.split('')
.map(c => `%${('00' + c.charCodeAt(0).toString(16)).slice(-2)}`)
.join('');
return decodeURIComponent(modifiedBinaryString);
};
const Services = {};
export function decodeBinaryString(str) {
const binary = Base64.atob(str);
const modifiedBinaryString = binary
.split('')
.map(c => `%${('00' + c.charCodeAt(0).toString(16)).slice(-2)}`)
.join('');
return decodeURIComponent(modifiedBinaryString);
}
//# sourceMappingURL=Bluetooth.js.map
export function decodeBinaryString(str: string): string {
const binary = Base64.atob(str);
const modifiedBinaryString = binary
.split('')
.map(c => `%${('00' + c.charCodeAt(0).toString(16)).slice(-2)}`)
.join('');
return decodeURIComponent(modifiedBinaryString);
}
export function inflateBase64(encoded: string): string {
const bytes = Base64.atob(encoded);
return pako.inflate(bytes, { to: "string" });
}
export const b64decodeByte = (str) => {
return Base64.atob(str)
}
static fromBase64String(base64: string): Blob {
invariant(
base64 === 'string' && base64.length > 0,
'firestore.Blob.fromBase64String expects a string of at least 1 character in length'
);
return new Blob(Base64.atob(base64));
}