Skip to content

Commit

Permalink
Removed Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Luca Lagmöller committed Feb 28, 2019
1 parent e8dee93 commit 9e76688
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"antd": "^3.13.2",
"crypto-js": "^3.1.9-1",
"file-saver": "^2.0.0",
"file-to-array-buffer": "^1.0.0",
"jszip": "^3.1.5",
"react": "^16.8.2",
"react-app-rewired": "^2.1.0",
Expand Down Expand Up @@ -37,4 +36,4 @@
"not op_mini all"
],
"devDependencies": {}
}
}
4 changes: 2 additions & 2 deletions src/worker/handleFiles.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import JSZip from "jszip";
import CryptoJS from "crypto-js";
import fileToArrayBuffer from "file-to-array-buffer";
import {
b64toBlob,
base64ArrayBuffer,
asyncForEach
asyncForEach,
fileToArrayBuffer
} from "./utils";

export const getSHA256 = async (value) => {
Expand Down
15 changes: 15 additions & 0 deletions src/worker/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ export function b64toBlob(b64Data, contentType, sliceSize) {
return blob;
}

export function fileToArrayBuffer(file) {
return new Promise(function (resolve, reject) {
const reader = new FileReader()

reader.onerror = function onerror(ev) {
reject(ev.target.error)
}

reader.onload = function onload(ev) {
resolve(ev.target.result)
}

reader.readAsArrayBuffer(file)
})
}

export function base64ArrayBuffer(arrayBuffer) {
var base64 = "";
Expand Down

0 comments on commit 9e76688

Please sign in to comment.