MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / dropFile

Function dropFile

lib/helper/scripts/dropFile.js:1–11  ·  view source on GitHub ↗
(el, { base64Content, fileName, mimeType })

Source from the content-addressed store, hash-verified

1export const dropFile = (el, { base64Content, fileName, mimeType }) => {
2 const binaryStr = atob(base64Content)
3 const bytes = new Uint8Array(binaryStr.length)
4 for (let i = 0; i < binaryStr.length; i++) bytes[i] = binaryStr.charCodeAt(i)
5 const fileObj = new File([bytes], fileName, { type: mimeType })
6 const dataTransfer = new DataTransfer()
7 dataTransfer.items.add(fileObj)
8 el.dispatchEvent(new DragEvent('dragenter', { dataTransfer, bubbles: true }))
9 el.dispatchEvent(new DragEvent('dragover', { dataTransfer, bubbles: true }))
10 el.dispatchEvent(new DragEvent('drop', { dataTransfer, bubbles: true }))
11}

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected