Make images smaller using best-in-class codecs, right in the browser.
JavaScript
Use `new Response(file).text()` to obtain a binary string
Jason Millerc741f245a65a
diff --git a/src/components/app/index.tsx b/src/components/app/index.tsxindex f17deb1c..4305594e 100644--- a/src/components/app/index.tsx+++ b/src/components/app/index.tsx@@ -76,19 +76,18 @@ export default class App extends Component<Props, State> {files: [fileObj]});- let done = () => {- let files = this.state.files.slice();- files[files.indexOf(fileObj)] = Object.assign({}, fileObj, {- error: fr.error,- loading: false,- data: fr.result+ new Response(file).text()+ .then(data => ({ data }))+ .catch(error => ({ error }))+ .then(state => {+ console.log(state);+ let files = this.state.files.slice();+ files[files.indexOf(fileObj)] = Object.assign({}, fileObj, {+ loading: false,+ ...state+ });+ this.setState({ files });});- this.setState({ files });- };-- let fr = new FileReader();- fr.onerror = fr.onloadend = done;- fr.readAsDataURL(file);}render({ url }: Props, { showDrawer, showFab, files }: State) {