All files / web/src/components/create/abacus download-blob.ts

100% Statements 13/13
100% Branches 1/1
100% Functions 1/1
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 141x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x  
'use client'
 
// The studio's one "save this file" idiom: an anchored object URL, clicked and
// revoked. Factored out of FabricationRail when ModularSeamPanel became the
// second consumer — never fork, always factor.
 
export function downloadBlob(blob: Blob, filename: string) {
  const a = document.createElement('a')
  a.href = URL.createObjectURL(blob)
  a.download = filename
  a.click()
  URL.revokeObjectURL(a.href)
}