What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-21 22:33:13
nodejs sharp change image to multiple sizes
// Sharp and FS module needed. ;(async function(){ let imgBuffer = await sharp("./myimage.jpg").toBuffer() let thumbnail = await sharp(imgBuffer).resize(100, 100).toBuffer() let image = await sharp(imgBuffer).resize(1600, 900).toBuffer(... Add solution -
Other 2021-10-28 03:18:14
fs.access doens' do anything
import {promises as fs} from "fs"; import * as oldfs from "fs"; (async function() { // fs.stat has higher level abstraction const stat = await fs.stat(__dirname); console.log(stat.isDirectory()); console.log(stat.isFil... Add solution -
Javascript 2021-10-03 18:33:05
react native cognito passwordless
export function sendAuthCode(email) { const loginDetails = new AuthenticationDetails({ Username: email }); const preAuthCognitoUser = createCognitoUser(email); preAuthCognitoUser.setAuthenticationFlowType("CUSTOM_AUTH"); return new Prom... Add solution -
Javascript 2021-09-28 06:51:05
service worker self.clients
addEventListener('notificationclick', event => { event.waitUntil(async function() { const allClients = await clients.matchAll({ includeUncontrolled: true }); let chatClient; // Let's see if we already have a chat window open: ... Add solution -
Javascript 2021-09-01 07:46:02
asynchronous function using function constructor
const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor; // assume someAsyncCall is a call to another async func we await for that returns 1 (just make this simpler) const func = new AsyncFunction('arg1', 'arg2', 'return arg1 * arg2 * ... Add solution