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
const fetchInfo = ; { try // EXAMPLE 1 // // Get information from a remote image const pngInfo = await ; console; // { // 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 ; console; // { fileSize: 110706004, mediaType: 'application/x-xz' } // EXAMPLE 3 // // Provide helpful options const kittenInfo = await ; console; // { // height: 480, // width: 640, // type: 'jpg', // fileSize: 27172, // mediaType: 'image/jpeg' // } catch err console; } ;