Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/zzarcon/flat-files
- Owner: zzarcon
- License: mit
- Created: 2017-10-16T04:11:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T09:56:53.000Z (about 2 years ago)
- Last Synced: 2024-05-21T11:06:06.949Z (8 months ago)
- Topics: drag-and-drop, dropzone, files, filesystem, filesystem-api, flatten, flattening
- Language: TypeScript
- Homepage: https://zzarcon.github.io/flat-files
- Size: 6.06 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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