-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.html
44 lines (39 loc) · 1.15 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div>
<form id='captureMedia' >
<input type='file' id="input-file"/><br/>
</form>
</div>
<script src="dist/rabin.umd.js"></script>
<script>
const dom = {
input: document.querySelector('#input-file'),
form: document.querySelector('#captureMedia')
}
dom.form.addEventListener('submit', (event)=> {
event.preventDefault()
})
dom.form.addEventListener('change', (event)=> {
event.stopPropagation()
event.preventDefault()
new Response(event.target.files[0])
.arrayBuffer()
.then(buffer => {
Rabin.create()
.then(r => {
const size = r.fingerprint(new Uint8Array(buffer))
console.log(size);
})
})
})
</script>
</body>
</html>