zzarcon / flat-files

Get a flatten array of dropped files using FileSystem api

Home Page:https://zzarcon.github.io/flat-files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get a flatten array of dropped files using FileSystem api

Demo

https://zzarcon.github.io/flat-files

Usage

import flatFiles from 'flat-files';

flatFiles(document.querySelector('#dropzone'), (files: FileSystemEntry[]) => {
  files.forEach(file => {
    console.log(
      file.name,
      file.fullPath,
      file.getMetadata()
    );
  })
});

Use case

Imagine you have drag & drop support in your app, thats great. Now imagine the use drops a folder containing a folder containing a folder, containing a folder... you get the idea.

All that I want is to have a nice way to get all those files and do something with them (upload them, show a preview, etc). Thats what flat-files gives to you, it deals with the FileSystem and gives a flatten array of FileSystemEntry

TODO

  • Release script
  • Browser support
  • Error callback

About

Get a flatten array of dropped files using FileSystem api

https://zzarcon.github.io/flat-files

License:MIT License


Languages

Language:TypeScript 80.7%Language:JavaScript 15.7%Language:HTML 2.7%Language:CSS 0.9%