See also:
Service | Type | RAM | Storage | Limitations |
---|---|---|---|---|
👉 Adaptable | PaaS | 256 MB | Non-persistent? (1 GB database storage available) | |
AWS EC2 | IaaS | 1 GB |
async function compressAndBase64(file, { | |
quality = 91, | |
scaleFactor = Math.log(file.size) / 13, // scale down images over 1MB | |
} = {}) { | |
return new Promise((res, rej)=>{ | |
const img = new Image(); | |
img.src = URL.createObjectURL(file); | |
img.onload = function() { | |
const canvas = document.createElement('canvas'); | |
const ctx = canvas.getContext('2d'); |
<head> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.14.2/dist/tf.min.js"></script> | |
<script> | |
const worker_function = () => { | |
onmessage = () => { | |
console.log('from web worker') | |
this.window = this | |
importScripts('https://cdn.jsdelivr.net/npm/setimmediate@1.0.5/setImmediate.min.js') | |
importScripts('https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.10.3') |
// Web-Push | |
// Public base64 to Uint | |
function urlBase64ToUint8Array(base64String) { | |
var padding = '='.repeat((4 - base64String.length % 4) % 4); | |
var base64 = (base64String + padding) | |
.replace(/\-/g, '+') | |
.replace(/_/g, '/'); | |
var rawData = window.atob(base64); | |
var outputArray = new Uint8Array(rawData.length); |