url-file-size
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/url-file-size package

1.0.5-1 • Public • Published

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.

const ufs = require("url-file-size");

ufs("https://dimden.dev/logo.png")
    .then(console.log) // 1416
    .catch(console.error);

Created by dimden

Package Sidebar

Install

npm i url-file-size

Weekly Downloads

2,985

Version

1.0.5-1

License

MIT

Unpacked Size

3.12 kB

Total Files

3

Last publish

Collaborators

  • dimden