This package has been deprecated

Author message:

please

@hacdias/datatransfer-files-promise

1.2.0 • Public • Published

datatransfer-files-promise

Get a promise for a flat array of files from the 'drop' event, like <input type="file"/>.files. Directories are traversed recursively.

Usage:

const { getFilesFromDataTransferItems } = require('datatransfer-files-promise')

const dropArea = document.querySelector('.drop-area')
dropArea.addEventListener('drop', event => {
  event.preventDefault()
  const items = event.dataTransfer.items
  getFilesFromDataTransferItems(items)
    .then(files => {
      ...
      console.log(files[0].filepath)
    })
}, false)

filepath is the property added to each file for convenience. If you don't want it for some reason then use getFilesFromDataTransferItems(items, {raw: true}).

/@hacdias/datatransfer-files-promise/

    Package Sidebar

    Install

    npm i @hacdias/datatransfer-files-promise

    Weekly Downloads

    0

    Version

    1.2.0

    License

    ISC

    Unpacked Size

    4.02 kB

    Total Files

    4

    Last publish

    Collaborators

    • hacdias