(If you have setup another prefix)
rm -rf .npm-global
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall node --ignore-dependencies node
rm -rf /usr/local/lib/node_modules
const functions = require('firebase-functions'); | |
const gcs = require('@google-cloud/storage')(); | |
const sharp = require('sharp') | |
const _ = require('lodash'); | |
const path = require('path'); | |
const os = require('os'); | |
exports.generateThumbnail = functions.storage.object('uploads/{imageId}').onChange(event => { | |
const object = event.data; // The Storage object. |
function getKeys(obj, prefix = '') { | |
if (typeof obj === 'undefined' || obj === null) return []; | |
return [ | |
...Object.keys(obj).map(key => `${prefix}${key}`), | |
...Object.entries(obj).reduce((acc, [key, value]) => { | |
if (typeof value === 'object') return [...acc, ...getKeys(value, `${prefix}${key}.`)]; | |
return acc; | |
}, []), | |
]; | |
} |