Last active
March 14, 2018 10:15
-
-
Save ejhayes/eca784925800d8417ece to your computer and use it in GitHub Desktop.
Request partial byte range of png using 206 partial content request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PNG file structure | |
// taken from: http://www.w3.org/TR/REC-png-961001#Structure | |
var xhr = new XMLHttpRequest; | |
xhr.onreadystatechange = function () { | |
if (xhr.readyState != 4) { | |
return; | |
} | |
debugger; | |
console.log(xhr); // xhr.response (the byte range of the png) | |
}; | |
xhr.open('GET', 'http://pngimg.com/upload/dog_PNG161.png', true); | |
xhr.setRequestHeader('Range', 'bytes=100-200'); | |
xhr.send(null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment