console
document.getElementById("zipInput").addEventListener("change", handleFile);
function handleFile(event) {
const file = event.target.files[0];
const reader = new FileReader();
reader.onload = function (e) {
const base64String = e.target.result.split(",")[1];
document.body.innerHTML =
"Base64 编码:" + base64String.length + "\n" + base64String;
};
reader.readAsDataURL(file);
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="robots" content="noindex, nofollow" />
<meta name="googlebot" content="noindex, nofollow" />
<title>测试erxiaxia - JSRUN 驱动</title>
<script type="text/javascript" src=""></script>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<input type="text" id="zipInput" />
<button style="display: none" onclick="convertAndDownload()">
转换并下载
</button>
<script type="application/javascript" src="main.js"></script>
</body>
</html>