{"id":19080440,"url":"https://github.com/fdezromero/request-image-size","last_synced_at":"2025-04-15T03:53:51.975Z","repository":{"id":18949557,"uuid":"22169627","full_name":"FdezRomero/request-image-size","owner":"FdezRomero","description":"Detect image dimensions via request.","archived":false,"fork":false,"pushed_at":"2022-12-09T23:06:36.000Z","size":150,"stargazers_count":38,"open_issues_count":7,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-15T03:53:45.988Z","etag":null,"topics":["detect","dimension","height","image","javascript","nodejs","probe","promise","request","resolution","size","width"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FdezRomero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-23T18:50:39.000Z","updated_at":"2024-05-21T14:33:44.000Z","dependencies_parsed_at":"2023-01-13T20:05:57.342Z","dependency_job_id":null,"html_url":"https://github.com/FdezRomero/request-image-size","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FdezRomero%2Frequest-image-size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FdezRomero%2Frequest-image-size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FdezRomero%2Frequest-image-size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FdezRomero%2Frequest-image-size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FdezRomero","download_url":"https://codeload.github.com/FdezRomero/request-image-size/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003955,"owners_count":21196794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detect","dimension","height","image","javascript","nodejs","probe","promise","request","resolution","size","width"],"created_at":"2024-11-09T02:23:58.358Z","updated_at":"2025-04-15T03:53:51.955Z","avatar_url":"https://github.com/FdezRomero.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# request-image-size\n\n[![NPM](https://nodei.co/npm/request-image-size.png)](https://nodei.co/npm/request-image-size/)\n\nDetects image dimensions via [request](https://github.com/request/request) instead of Node.js native `http`/`https`, allowing for options and following redirects by default. It reduces network traffic by aborting requests as soon as [image-size](https://github.com/image-size/image-size) is able to obtain the image size.\n\nSince version 2.0.0 it returns an ES6 native `Promise` that resolves with the `size` object or rejects with an `Error`. Requires Node.js v4+.\n\nIf you prefer using a callback, please use version 1.3.0 instead ([docs](CHANGELOG.md))\n\nSupports all the image formats supported by [image-size](https://github.com/image-size/image-size):\n- BMP\n- CUR\n- GIF\n- ICO\n- JPEG\n- PNG\n- PSD\n- TIFF\n- WebP\n- SVG\n- DDS\n\n### Dependencies\n- [request](https://github.com/request/request)\n- [image-size](https://github.com/image-size/image-size)\n- [standard-http-error](https://github.com/moll/js-standard-http-error)\n\n## Basic usage\n\n```js\nconst requestImageSize = require('request-image-size');\n\nrequestImageSize('http://nodejs.org/images/logo.png')\n.then(size =\u003e console.log(size))\n.catch(err =\u003e console.error(err));\n```\n\nResult:\n```js\n{ width: 245, height: 66, type: 'png', downloaded: 856 }\n```\n\n\n## Advanced usage\n\nSpecifying a request `options` object ([docs](https://github.com/request/request/#requestoptions-callback)):\n\n```js\nconst requestImageSize = require('request-image-size');\n\nconst options = {\n  url: 'http://nodejs.org/images/logo.png',\n  headers: {\n    'User-Agent': 'request-image-size'\n  }\n};\n\nrequestImageSize(options)\n.then(size =\u003e console.log(size))\n.catch(err =\u003e console.error(err));\n```\n\n## License\n\nCopyright (c) 2017 Rodrigo Fernández Romero\n\nLicensed under the MIT license.\n\nBased on [http-image-size](https://github.com/jo/http-image-size) from Johannes J. Schmidt.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdezromero%2Frequest-image-size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffdezromero%2Frequest-image-size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffdezromero%2Frequest-image-size/lists"}