Created
January 3, 2020 01:39
-
-
Save hadrysmateusz/5d0eabb4510db2404589c8af9e232661 to your computer and use it in GitHub Desktop.
Markdium-Files in Client-Side JS: Ultimate Guide to Using Files in Web Applications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// assuming that processImage and processText are functions | |
if (file.type.startsWith('image/')) { | |
reader.onload = processImage | |
reader.readAsDataURL(file) | |
} else if (file.type.startsWith('text/')) { | |
reader.onload = processText | |
reader.readAsText(file) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment