Created
March 28, 2021 07:07
-
-
Save jjylik/3a96305cc9749b15870b545a020f9f58 to your computer and use it in GitHub Desktop.
Fetch content length
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
async function fetchContentLength(url: string): Promise<string | null> { | |
const response = await fetch(url, {method: 'HEAD'}); | |
return response.headers.get('content-length'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment