datatransfer-tree
v1.1.0
Published
Library for parsing DataTransfer entries into a structured directory tree objects
Downloads
9
Readme
datatransfer-tree
Library for parsing DataTransfer entries into a structured directory tree objects.
Installation
npm i datatransfer-tree
Usage
import getEntriesTree from 'datatransfer-tree';
element.addEventListener('drop', (event) => {
event.preventDefault();
const { dataTransfer } = event;
if (!dataTransfer) {
return;
}
const entries = Array.from(dataTransfer.items, (item) => item.webkitGetAsEntry());
console.log(await getEntriesTree(entries));
});