MCPcopy Create free account
hub / github.com/react-dropzone/react-dropzone / createDtWithFiles

Function createDtWithFiles

src/index.spec.js:3782–3796  ·  view source on GitHub ↗

* createDtWithFiles creates a mock data transfer object that can be used for drop events * @param {File[]} files * @param {object} options * @param {boolean} options.emptyTypes - If true, sets item types to empty string (simulates Chrome drag behavior)

(files = [], options = {})

Source from the content-addressed store, hash-verified

3780 * @param {boolean} options.emptyTypes - If true, sets item types to empty string (simulates Chrome drag behavior)
3781 */
3782function createDtWithFiles(files = [], options = {}) {
3783 const { emptyTypes = false } = options;
3784 return {
3785 dataTransfer: {
3786 files,
3787 items: files.map((file) => ({
3788 kind: "file",
3789 size: file.size,
3790 type: emptyTypes ? "" : file.type,
3791 getAsFile: () => file,
3792 })),
3793 types: ["Files"],
3794 },
3795 };
3796}
3797
3798/**
3799 * createFileSystemFileHandle creates a mock [FileSystemFileHandle](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle)

Callers 1

index.spec.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…