Get started with filesize CDN
BSD-3-Clause licensed
Filesize.js is a lightweight library for displaying human-readable file sizes.
Tags:- file
- filesize
- size
- readable
- file system
- bytes
- diff
Stable version
Copied!
How to start using filesize CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with filesize CDN - cdnhub.io</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/filesize.min.js"></script>
</head>
<body>
<input type="file" id="fileInput" accept=".txt, .pdf">
<button id="calculateButton">Calculate File Size</button>
<p id="fileSizeResult"></p>
<script>
const fileInput = document.querySelector('#fileInput');
const calculateButton = document.querySelector('#calculateButton');
const fileSizeResult = document.querySelector('#fileSizeResult');
calculateButton.addEventListener('click', () => {
Filesize.load((filesizeApi) => {
filesizeApi.loadFile(fileInput.files[0], (errors, fileSize) => {
if (errors) {
console.error('Error calculating file size:', errors);
return;
}
fileSizeResult.textContent = `File size: ${fileSize.size} bytes`;
});
});
});
</script>
</body>
</html>
All versions
1.0.0
1.1.0
1.10.0
1.2.0
1.3.0
1.4.0
1.5.0
1.6.0
1.6.1
1.6.2
1.6.3
1.6.4
1.6.5
1.6.6
1.6.7
1.7.0
1.7.1
1.7.2
1.7.3
1.7.4
1.7.5
1.7.6
1.7.7
1.7.8
1.7.9
1.8.0
1.9.0
1.9.1
1.9.2
1.9.3
1.9.4
1.9.5
1.9.6
1.9.7
10.0.0
10.0.1
10.0.10
10.0.11
10.0.12
10.0.13
10.0.2
10.0.3
10.0.5
10.0.6
10.0.7
10.0.8
10.0.9
10.1.0
10.1.1
10.1.2
10.1.3
10.1.4
10.1.5
*** 10.1.6
2.0.0
2.0.1
2.0.2
2.0.3
2.0.4
3.0.0
3.0.1
3.0.2
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.1.5
3.1.6
3.2.0
3.2.1
3.3.0
3.4.0
3.4.1
3.4.2
3.4.3
3.5.0
3.5.1
3.5.10
3.5.11
3.5.2
3.5.3
3.5.4
3.5.5
3.5.6
3.5.7
3.5.8
3.5.9
3.6.0
3.6.1
4.0.0
4.1.0
4.1.1
4.1.2
4.2.0
4.2.1
5.0.0
5.0.1
5.0.2
5.0.3
6.0.0
6.0.1
6.1.0
6.2.0
6.2.1
6.2.2
6.2.3
6.2.4
6.2.5
6.2.6
6.3.0
6.4.0
7.0.0
8.0.0
8.0.1
8.0.2
8.0.3
8.0.4
8.0.5
8.0.6
8.0.7
9.0.0
9.0.1
9.0.10
9.0.11
9.0.2
9.0.3
9.0.4
9.0.5
9.0.6
9.0.7
9.0.8
9.0.9