https://github.com/dimdengd/url-file-size
Get file size from URL (in bytes) without downloading it. 0 dependencies.
https://github.com/dimdengd/url-file-size
Last synced: 11 months ago
JSON representation
Get file size from URL (in bytes) without downloading it. 0 dependencies.
- Host: GitHub
- URL: https://github.com/dimdengd/url-file-size
- Owner: dimdenGD
- Created: 2021-01-15T10:38:06.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-09-30T11:17:25.000Z (over 3 years ago)
- Last Synced: 2025-06-14T02:40:11.222Z (12 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# url-file-size
Get file size from URL (in bytes) without downloading it. 0 dependencies.
Params:
- `url` - url to get file size of. string or instance of `require('url').URL` (required)
- `timeout` - connection timeout. number in milliseconds (optional, default is `10000`)
- `maxRedirects` - max amount of redirects. number (optional, default is `5`)
Returns `Promise` with bytes on success.
```js
const ufs = require("url-file-size");
ufs("https://dimden.dev/logo.png")
.then(console.log) // 1416
.catch(console.error);
```
Created by [dimden](https://dimden.dev/)