file-selector

  • Version 2.1.2
  • Published
  • 623 kB
  • 1 dependency
  • MIT license

Install

npm i file-selector
yarn add file-selector
pnpm add file-selector

Overview

Convert DataTransfer object to a list of File objects

Index

Functions

function fromEvent

fromEvent: (evt: Event | any) => Promise<(FileWithPath | DataTransferItem)[]>;
  • Convert a DragEvent's DataTrasfer object to a list of File objects NOTE: If some of the items are folders, everything will be flattened and placed in the same list but the paths will be kept as a {path} property.

    EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg and a list of File objects will be returned.

    Parameter evt

Interfaces

interface FileWithPath

interface FileWithPath extends File {}

    property handle

    readonly handle?: FileSystemFileHandle;

      property path

      readonly path?: string;

        property relativePath

        readonly relativePath?: string;

          Package Files (3)

          Dependencies (1)

          Dev Dependencies (13)

          Peer Dependencies (0)

          No peer dependencies.

          Badge

          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/file-selector.

          • Markdown
            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/file-selector)
          • HTML
            <a href="https://www.jsdocs.io/package/file-selector"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>