This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from "@angular/core"; | |
@Component({ | |
selector: "app-root", | |
templateUrl: "./app.component.html", | |
styleUrls: ["./app.component.css"] | |
}) | |
export class AppComponent { | |
title = "CodeSandbox"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const base64 = '...'; | |
const imageName = 'name.png'; | |
const imageBlob = this.dataURItoBlob(base64); | |
const imageFile = new File([imageBlob], imageName, { type: 'image/png' }); | |
dataURItoBlob(dataURI) { | |
const byteString = window.atob(dataURI); | |
const arrayBuffer = new ArrayBuffer(byteString.length); | |
const int8Array = new Uint8Array(arrayBuffer); | |
for (let i = 0; i < byteString.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getUsuarioByID = (id, callback) => { | |
const usuario = { | |
id, | |
nombre: 'Mario' | |
} | |
setTimeout(() => { | |
callback(usuario); | |
}, 1500); | |
} |