This file contains 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
/* Input */ | |
const recipes = [ | |
{ | |
name: 'Fried Chicken', | |
categories: ['chicken', 'meat'] | |
}, | |
{ | |
name: 'Spinach Pasta', | |
categories: ['pasta', 'vegan'] |
This file contains 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 response = await fetch("https://pbs.twimg.com/profile_images/1457798886710738944/HWg9ES8r_400x400.jpg") | |
const contentType = response.headers.get("Content-Type"); | |
const blob = await response.blob(); | |
const arrayBuffer = await blob.arrayBuffer(); | |
const buffer = Buffer.from(arrayBuffer); | |
const dataUri = `data:${contentType};base64,${buffer.toString('base64')}`; | |
const upload = await cloudinary.uploader.upload(dataUri); |
OlderNewer