(val: string)
| 8 | |
| 9 | const base36 = BaseX('0123456789abcdefghijklmnopqrstuvwxyz'); |
| 10 | export function hashString(val: string): string { |
| 11 | const hash = crypto.createHash('sha1'); |
| 12 | const data = hash.update(val, 'utf-8'); |
| 13 | return base36.encode(data.digest()); |
| 14 | } |
| 15 | |
| 16 | export async function writeWorker(dirname: string, content: string): Promise<string> { |
| 17 | const filename = `worker-${hashString(content)}.js`; |