# url-file-size

> Get file size by URL without downloading it

Latest version **1.0.5-1** (published 2022-09-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install url-file-size
pnpm add url-file-size
yarn add url-file-size
bun add url-file-size
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5-1 |
| Published | 2022-09-30 |
| First published | 2021-01-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/url-file-size) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | dimden |
| Maintainers | dimden |
| Keywords | url, file, size, file, size, remote |

## Links

- npm: https://www.npmjs.com/package/url-file-size
- Repository: https://github.com/dimdenGD/url-file-size
- Homepage: https://github.com/dimdenGD/url-file-size#readme
- Issues: https://github.com/dimdenGD/url-file-size/issues
- npm.io page: https://npm.io/package/url-file-size

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.5-1 (latest) — 2022-09-30
- 1.0.5 — 2022-09-30
- 1.0.4 — 2022-09-08
- 1.0.3 — 2022-08-01
- 1.0.2 — 2022-06-26
- 1.0.1 — 2021-12-13
- 1.0.0 — 2021-01-15

## 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<Number>` 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/)

---
_Source: https://npm.io/package/url-file-size · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
