{"name":"probe-image-size","version":"6.0.0","description":"Get image size without full download (JPG, GIF, PNG, WebP, BMP, TIFF, PSD)","keywords":["image","size","jpg","jpeg","ico","gif","png","webp","tiff","bmp","svg","psd"],"repository":{"type":"git","url":"git+https://github.com/nodeca/probe-image-size.git"},"license":"MIT","scripts":{"lint":"eslint .","test":"npm run lint && nyc mocha","coverage":"npm run test && nyc report --reporter html","report-coveralls":"nyc report --reporter=text-lcov | coveralls"},"mocha":{"timeout":5000},"dependencies":{"deepmerge":"^4.0.0","needle":"^2.5.2","stream-parser":"~0.3.1"},"devDependencies":{"coveralls":"^3.0.0","eslint":"^7.12.1","mocha":"^8.2.0","nyc":"^15.1.0"},"gitHead":"c16972265caba1e3caa636d37a23f42eb2dc878f","bugs":{"url":"https://github.com/nodeca/probe-image-size/issues"},"homepage":"https://github.com/nodeca/probe-image-size#readme","_id":"probe-image-size@6.0.0","_nodeVersion":"14.14.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-99PZ5+RU4gqiTfK5ZDMDkZtn6eL4WlKfFyVJV7lFQvH3iGmQ85DqMTOdxorERO26LHkevR2qsxnHp0x/2UDJPA==","shasum":"4a85b19d5af4e29a8de7d53a9aa036f6fd02f5f4","tarball":"http://registry-npm.ywwl.com/probe-image-size/download/probe-image-size-6.0.0.tgz","fileCount":29,"unpackedSize":47030,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfowI/CRA9TVsSAnZWagAA6ogP/3JKXgWUIVFL4H4WZwji\nbMeyFDBni3WrAu/x3OVKNVXPWKEskUaCVPjVWqOcIsBwbwjGb9Kall6Zpv2i\nwTPxnP0qmY0CvJBclZ+CC0dG9LCSWEWr4G+PCuUNQAL/bDYA6J83rsElivIB\nBE47T5ZQzXlkTVjqjN7t6RydR36ODyEHcMxnCdr4+58ukyDKlB6pBu//Hfh6\ntsBY/i6Kspn1y51ckS5tfUjTavoVAVyhosoWu5TDV1tx4T4eyqD6ZqWRIOw0\nt9wYcSvSL98robjH+54jdvsbijvCbWf1d4M7I3z3SM0zFFokaY01j4Uy9LsV\nyWAELRG+y+MPMf9XfiXLyjnXC5IDob5lS3DXhi+YQkoxOOMjki312AmTNC0x\n/SFAnvv4ydCnE+hB1M5CeNvdoWZsbMcLkrgXEg8r4yy0bzAhYnc52CWxBCQU\nO94CdCKKdemffVHfAsb+H1jiqNwkrgjic8528vdkeDF76TIoOS5mhMzGXVGE\n6flupJ9ZoaJ9kODWwlZ4gmFUnyieuz4rDIM606QDyPh0/diD70woeJKq/dCh\nhOCMdTJ6ItHXnFHkzkemdnYfMwkk+BBgvtdbJE2zMYmxqOD3gwIVbwFku/Xc\n0TaSqCuQjOcut4t6dWqeiUhJqNeMt3hv+dH8bATO9iblki/Xxackpws1xhDJ\nPnSy\r\n=XibL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDIpclNF+cUaFd7AkptDeD3/S3poLZeE/EUKdOq1S4VwIgAhifl6+NwtU3xzDD47x7ULXJiE97RMmvyb7fdMceGZ4="}],"size":12243,"noattachment":false,"key":"/probe-image-size/-/probe-image-size-6.0.0.tgz"},"_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"directories":{},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/probe-image-size_6.0.0_1604518463220_0.3995703274309237"},"_hasShrinkwrap":false,"readme":"probe-image-size\n================\n\n[![CI](https://github.com/nodeca/probe-image-size/workflows/CI/badge.svg?branch=master)](https://github.com/nodeca/probe-image-size/actions)\n[![NPM version](https://img.shields.io/npm/v/probe-image-size.svg?style=flat)](https://www.npmjs.org/package/probe-image-size)\n[![Coverage Status](https://coveralls.io/repos/github/nodeca/probe-image-size/badge.svg?branch=master)](https://coveralls.io/github/nodeca/probe-image-size?branch=master)\n\n> Get image size without full download. Supported image types:\n> JPG, GIF, PNG, WebP, BMP, TIFF, SVG, PSD, ICO, AVIF, HEIC, HEIF.\n\nKey features:\n\n- small size, no heavy dependencies\n- works with remote and local data\n- effective with big images (speed/memory), download minimal data from remotes\n- extracts orientation value when available\n- easy to browserify (splitted to components)\n\n\nInstall\n-------\n\n```bash\nnpm install probe-image-size\n```\n\nExample\n-------\n\n```js\nconst probe = require('probe-image-size');\n\n// Get by URL\nlet result = await probe('http://example.com/image.jpg');\nconsole.log(result); // =>\n/*\n  {\n    width: xx,\n    height: yy,\n    type: 'jpg',\n    mime: 'image/jpeg',\n    wUnits: 'px',\n    hUnits: 'px',\n    url: 'http://example.com/image.jpg'\n  }\n*/\n\n\n// By URL with options\nlet result = await probe('http://example.com/image.jpg', { rejectUnauthorized: false });\nconsole.log(result);\n\n\n// From the stream\nlet result = await probe(require('fs').createReadStream('image.jpg'));\nconsole.log(result);\n\n\n// From a Buffer (sync)\nlet data = require('fs').readFileSync('image.jpg');\nconsole.log(probe.sync(data));\n```\n\n\nAPI\n---\n\nNote:\n\n- You can access/browserify `stream.js` / `http.js` / `sync.js` directly.\n- If you don't like `http.js` dependencies, you can create your own wrapper\n  for `stream.js`.\n\n### probe(src [, options|keepOpen]) -> Promise\n\n- `src` can be of this types:\n  - _String_ - URL to fetch\n  - _Stream_ - readable stream\n- `options` - HTTP only. See [`needle` documentation](https://github.com/tomas/needle#request-options), and customized [defaults](https://github.com/nodeca/probe-image-size/blob/master/http.js#L13).\n- `keepOpen` (Boolean) - stream only. Keep stream open after parser finishes\n  (input stream will be closed by default)\n\n`result` (Promise) contains:\n\n```js\n{\n  width: XX,\n  height: YY,\n  length: ZZ,   // byte length of the file (if available, HTTP only)\n  type: ...,    // image 'type' (usual file name extention)\n  mime: ...,    // mime type\n  wUnits: 'px', // width units type ('px' by default, can be different for SVG)\n  hUnits: 'px', // height units type ('px' by default, can be different for SVG)\n  url: ...,     // HTTP only, last url for the image in chain of redirects\n                // (if no redirects, same as src)\n\n  // optional, image orientation (from Exif), number from 1 to 8;\n  // you may wish to swap width and height if orientation is >= 5\n  orientation: X,\n\n  // optional, full list of sizes for ICO (always) and AVIF (if multiple images)\n  variants: [ { width, height }, ... ] | undefined\n}\n```\n\nWidth and height in the output object represent image size *before* any transformations\n(orientation, cropping) are applied. Orientation is returned separately, which you may\nwish to apply afterwards depending on browser support (browsers\n[only support JPEG](https://zpl.fi/exif-orientation-in-different-formats/) orientation for now).\nSee [known issues](known_issues.md) for details.\n\nReturned errors can be extended with 2 fields:\n\n- `code` - equals to `ECONTENT` if the library failed to parse the file;\n- `status` - equals to a HTTP status code if it receives a non-200 response.\n\n\n### probe.sync(src) -> result|null\n\nSync version can eat arrays, typed arrays and buffers. On success it returns\nthe same result as async version. On fail it returns null.\n\n__Note.__ Formats like JPEG & TIFF can store size anywhere (far from the head).\nThat usually does not happens, but if you need guarantees - always provide full\nfile content to sync methods. We strongly recommend to use async version\nas memory-friendly.\n\n\nSimilar projects\n----------------\n\n- [image-size](https://github.com/netroy/image-size)\n\n\nSupport probe-image-size\n------------------------\n\nYou can support this project via [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-probe-image-size?utm_source=npm-probe-image-size&utm_medium=referral&utm_campaign=readme).\n","publish_time":1604518463377,"_cnpm_publish_time":1604518463377,"dist-tags":{"latest":"7.5.0"}}