aboutsummaryrefslogtreecommitdiff
path: root/src/hooks/useS3Preupload.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/hooks/useS3Preupload.tsx')
-rw-r--r--src/hooks/useS3Preupload.tsx14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/hooks/useS3Preupload.tsx b/src/hooks/useS3Preupload.tsx
index 651bfb6..9516459 100644
--- a/src/hooks/useS3Preupload.tsx
+++ b/src/hooks/useS3Preupload.tsx
@@ -1,9 +1,8 @@
import { useState, useCallback, useMemo } from 'react';
import axios from 'axios';
import Bluebird from 'bluebird';
-import Compressor from 'compressorjs';
import { get } from '../requests';
-
+import { compressFile } from '../utils/files';
interface ProgressEvent {
loaded: number;
@@ -17,17 +16,6 @@ interface Hook {
progress: number;
}
-
-const compressFile = (file: File, quality = 0.6): Promise<Blob> => {
- return new Promise((resolve, reject) => {
- return new Compressor(file, {
- success: result => resolve(result),
- error: err => reject(err),
- quality
- });
- });
-};
-
export default (): Hook => {
const [url, setUrl] = useState<string>();
const [file, setFile] = useState<File>();