-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconvert.html
More file actions
31 lines (25 loc) · 787 Bytes
/
convert.html
File metadata and controls
31 lines (25 loc) · 787 Bytes
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
<script>
var openFile = function(event) {
var input = event.target;
var reader = new FileReader();
reader.onload = function() {
var text = reader.result;
var node = document.getElementById('output');
var bruh = '';
reader.result.split('').forEach((e)=>{
bruh += e.charCodeAt(0).toString(16).padStart(2, '0').toUpperCase();
});
<!-- node.innerText = bruh; -->
var link = document.createElement('a');
var file = new Blob([bruh], { type: 'text/plain' });
link.href = URL.createObjectURL(file);
link.download = input.files[0].name + '.txt';
link.click();
URL.revokeObjectURL(link.href);
};
reader.readAsBinaryString(input.files[0]);
};
</script>
<input type='file' onchange='openFile(event)'><br>
<!-- <textarea id='output'> -->
<!-- </textarea> -->