Skip to content

Instantly share code, notes, and snippets.



Created Sep 30, 2019
What would you like to do?
Downloading Slack emojis
import fs from 'fs';
import path from 'path';
import fetch from '@kiwicom/fetch';
// See:
import { emoji } from './emoji.json';
(async function() {
for (const [name, link] of Object.entries(emoji)) {
const downloadLink = link;
if (link.startsWith('alias:')) {
const result = await fetch(downloadLink);
const match = downloadLink.match(/.+\.(?<extension>[a-z]+)$/i);
const iconPath = path.join(__dirname, 'output', `${name}.${match.groups.extension}`);
const fileStream = fs.createWriteStream(iconPath);
result.body.on('finish', () => {
console.warn('Saved %s', iconPath);
result.body.on('error', err => {
throw err;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment