Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Get a flatten array of dropped files using FileSystem api
https://github.com/zzarcon/flat-files

drag-and-drop dropzone files filesystem filesystem-api flatten flattening

Last synced: about 1 month ago
JSON representation

Get a flatten array of dropped files using FileSystem api

Awesome Lists containing this project

README

        

# flat-files [![Build Status](https://travis-ci.org/zzarcon/flat-files.svg?branch=master)](https://travis-ci.org/zzarcon/flat-files) https://zzarcon.github.io/flat-files
> Get a flatten array of dropped files using FileSystem api

# Demo

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

# Usage

```javascript
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](https://developer.mozilla.org/en-US/docs/Web/API/FileSystem) and gives a flatten array of [FileSystemEntry](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry)



# TODO

* [ ] Release script
* [ ] Browser support
* [ ] Error callback