MCPcopy Create free account
hub / github.com/Sandpack/nodebox-runtime / hashString

Function hashString

internals/esbuild-plugins/inline-worker.ts:10–14  ·  view source on GitHub ↗
(val: string)

Source from the content-addressed store, hash-verified

8
9const base36 = BaseX('0123456789abcdefghijklmnopqrstuvwxyz');
10export 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
16export async function writeWorker(dirname: string, content: string): Promise<string> {
17 const filename = `worker-${hashString(content)}.js`;

Callers 1

writeWorkerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected