# remote-file-info

> Fetches information about remote file

Latest version **1.0.3** (published 2020-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install remote-file-info
pnpm add remote-file-info
yarn add remote-file-info
bun add remote-file-info
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-03-23 |
| First published | 2020-02-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Tuomas Jaakola |
| Maintainers | iqqmut |

## Links

- npm: https://www.npmjs.com/package/remote-file-info
- Repository: https://github.com/iqqmuT/remote-file-info
- Homepage: https://github.com/iqqmuT/remote-file-info#readme
- Issues: https://github.com/iqqmuT/remote-file-info/issues
- npm.io page: https://npm.io/package/remote-file-info

## Dependencies (1)

- [image-size](https://npm.io/package/image-size.md) ^0.8.3

## Recent versions

- 1.0.3 (latest) — 2020-03-23
- 1.0.2 — 2020-03-23
- 1.0.1 — 2020-02-14
- 1.0.0 — 2020-02-11

## README

# remote-file-info

![npm](https://img.shields.io/npm/v/remote-file-info) [![Build Status](https://travis-ci.org/iqqmuT/remote-file-info.svg?branch=master)](https://travis-ci.org/iqqmuT/remote-file-info)

A node module for fetching information about remote file

Fetches information about remote file without downloading the entire file. If given URL
is pointing to an image, the image dimensions are determined by the first few kilobytes.

## Installation

```
npm install remote-file-info
```

## Usage

```javascript
const fetchInfo = require('remote-file-info');

async function run() {
  try {
    // EXAMPLE 1
    //
    // Get information from a remote image
    const pngInfo = await fetchInfo('https://www.kernel.org/theme/images/logos/tux.png');
    console.log(pngInfo);

    // {
    //   height: 120,
    //   width: 104,
    //   type: 'png',
    //   fileSize: 7666,
    //   mediaType: 'image/png'
    // }

    // EXAMPLE 2
    //
    // Get information from a remote file without downloading it
    const fileInfo = await fetchInfo('https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.5.3.tar.xz');
    console.log(fileInfo);

    // { fileSize: 110706004, mediaType: 'application/x-xz' }

    // EXAMPLE 3
    //
    // Provide helpful options
    const kittenInfo = await fetchInfo('https://placekitten.com/640/480', {
      // Download entire file to know file size,
      // because server does not provide Content-Length header.
      downloadImgBytes: -1,

      // Tell that this URL is pointing to an image.
      isImage: true,
    });
    console.log(kittenInfo);

    // {
    //   height: 480,
    //   width: 640,
    //   type: 'jpg',
    //   fileSize: 27172,
    //   mediaType: 'image/jpeg'
    // }
  } catch (err) {
    console.error(err);
  }
}

run();
```

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