Skip to content

coderaiser/domfs-findit

Repository files navigation

DOM File System Findit

Similar to node-findit but for Dom File System.

Install

npm i domfs-findit

How to use?

You can use minified findit bundle with:

<script src="dist/findit.min.js"></script>

When you use webpack just import findit with:

import findit from `domfs-findit`;
window.addEventListener('drop', (e) => {
    e.preventDefault();
    
    const item = e.dataTransfer.items[0];
    const entry = item.webkitGetAsEntry();
    const finder = findit(entry);
    
    finder.on('file', (file, entry) => {
        console.log('file: ', file, entry);
    });
    
    finder.on('directory', (file, entry) => {
        console.log('directory: ', file, entry);
    })
    
    finder.on('end', () => {
        console.log('done');
    })
});

node.addEventListener('dragover', (e) => {
    e.preventDefault();
});

License

MIT