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
import fs from 'fs'; | |
import { spawn } from 'child_process'; | |
type Format = | |
| 'dxf' | |
| 'emf' | |
| 'eps' | |
| 'fxg' | |
| 'gpl' | |
| 'hpgl' |
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 isNode = typeof window === 'undefined' | |
// Regex from: https://stackoverflow.com/a/475217/4467741 | |
const encodedRegex = new RegExp('^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$') | |
export function decode(text: string) { | |
return isNode ? Buffer.from(text, 'base64').toString() : atob(text) | |
} | |
export function encode(text: string) { |