import * as fs from 'fs/promises'; import * as path from 'path'; import BaseElements from './require/base-elements'; import { Channel } from '../data-types'; import CombinedGuild from '../guild-combined'; export default function createUploadOverlayFromPath(document: Document, guild: CombinedGuild, channel: Channel, resourcePath: string): HTMLElement { let resourceName = path.basename(resourcePath); let element = BaseElements.createUploadOverlay(document, { guild: guild, channel: channel, resourceName: resourceName, resourceBuffFunc: async () => { return await fs.readFile(resourcePath); }, resourceSizeFunc: async () => { let stat = await fs.stat(resourcePath); return stat.size; } }); return element; }