https://github.com/muhamed-didovic/promisify-remote-file-size
https://github.com/muhamed-didovic/promisify-remote-file-size
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/muhamed-didovic/promisify-remote-file-size
- Owner: muhamed-didovic
- License: mit
- Created: 2022-03-18T09:08:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-17T15:18:57.000Z (about 3 years ago)
- Last Synced: 2025-02-25T11:23:53.207Z (2 months ago)
- Language: JavaScript
- Size: 48.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# promisify remote-file-size
Get the size of a remote file with, under the hood is used: https://www.npmjs.com/package/remote-file-size
[](https://www.npmjs.com/package/promisify-remote-file-size)
[](https://hits.seeyoufarm.com)## Install
```bash
$ npm install --save promisify-remote-file-size
# or for the cli tool
$ npm install -g promisify-remote-file-size
```## Usage
```bash
$ promisify-remote-file-size http://registry.npmjs.org/argsplit/-/argsplit-1.0.2.tgz
// => 1.55 kB
``````bash
const remote = require('promisify-remote-file-size')
const url = 'https://peakdevs.com/muhamed-resume.pdf'
await remote(url) // 219 kB
#or
remote(url).then(size => size) //219 kB
```## CLI Usage
```
$ promisify-remote-file-size --helppromisify-remote-file-size - get the size of a remote file
usage: promisify-remote-file-size [options]
options:
-h, --help show help and usage
-v, --version show version
-r, --raw show raw result (no pretty formatting)
-f, --follow-redirect follow redirects (true by default)
-m, --max-redirects set max number of redirects (defaults to 2)example:
promisify-remote-file-size https://peakdevs.com/muhamed-resume.pdf
// => 219 kBpromisify-remote-file-size --raw https://peakdevs.com/muhamed-resume.pdf
// => 218884```
`promisify-remote-file-size` uses `request` under the hood, so you could
also pass an options object instead of the url string.## Author
Muhamed Didovic
## License
MIT (See `LICENSE` for more info)