{"id":13548540,"url":"https://github.com/sindresorhus/is-progressive","last_synced_at":"2025-04-05T06:07:08.612Z","repository":{"id":25623660,"uuid":"29058911","full_name":"sindresorhus/is-progressive","owner":"sindresorhus","description":"Check if JPEG images are progressive","archived":false,"fork":false,"pushed_at":"2024-07-06T13:46:15.000Z","size":295,"stargazers_count":199,"open_issues_count":0,"forks_count":6,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-28T21:30:20.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"},"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-10T14:04:25.000Z","updated_at":"2025-01-07T20:11:03.000Z","dependencies_parsed_at":"2022-09-09T19:11:09.149Z","dependency_job_id":"f0e1c240-8344-42ed-99ff-4162690f1793","html_url":"https://github.com/sindresorhus/is-progressive","commit_stats":{"total_commits":37,"total_committers":7,"mean_commits":5.285714285714286,"dds":"0.18918918918918914","last_synced_commit":"0a745d218974951b73b8a6c86492a92422b14bc8"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fis-progressive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fis-progressive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fis-progressive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fis-progressive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/is-progressive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294536,"owners_count":20915340,"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":[],"created_at":"2024-08-01T12:01:11.627Z","updated_at":"2025-04-05T06:07:08.580Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript","Packages","包"],"sub_categories":["Image"],"readme":"# is-progressive\n\n\u003e Check if JPEG images are [progressive](http://www.faqs.org/faqs/jpeg-faq/part1/section-11.html)\n\nCan be useful to make sure your images are progressive, which is important for performance:\n\n\u003e Progressive JPEGs are better because they are faster. Appearing faster is being faster, and perceived speed is more important that actual speed. - [Progressive JPEGs: a new best practice](https://calendar.perfplanet.com/2012/progressive-jpegs-a-new-best-practice/)\n\nThe check is fast as it only reads a small part of the file.\n\n## Install\n\n```sh\nnpm install is-progressive\n```\n\n## Usage\n\n```js\nimport isProgressive from 'is-progressive';\n\nconsole.log(await isProgressive.file('baseline.jpg'));\n//=\u003e false\n\nisProgressive.fileSync('progressive.jpg');\n//=\u003e true\n```\n\n```js\n// Check if a remote JPEG image is progressive without downloading the whole file\nimport https from 'node:https';\nimport isProgressive from 'is-progressive';\n\nconst url = 'https://raw.githubusercontent.com/sindresorhus/is-progressive/main/fixture/progressive.jpg';\n\nhttps.get(url, async response =\u003e {\n\tconsole.log(await isProgressive.stream(response));\n\t//=\u003e true\n});\n```\n\n### API\n\nPrefer the file methods if you're dealing directly with files. Those methods are optimized to read in the least amount of bytes necessary to determine whether it's a progressive JPEG image.\n\n#### .buffer(buffer)\n\nReturns whether the `buffer` is a progressive JPEG image.\n\n##### buffer\n\nType: `Uint8Array`\n\nThe buffer of a JPEG image.\n\nMust be at least `65535` bytes when the file is larger than that.\n\n#### .stream(stream)\n\nReturns a `Promise\u003cboolean\u003e` indicating whether the file stream is a progressive JPEG image.\n\n##### stream\n\nType: `stream.Readable`\n\nA data stream with a JPEG image.\n\n#### .file(filePath)\n\nReturns a `Promise\u003cboolean\u003e` indicating whether the file at the `filePath` is a progressive JPEG image.\n\n##### filePath\n\nType: `string`\n\nThe file path to the image.\n\n#### .fileSync(filePath)\n\nWhether the file at the `filePath` is a progressive JPEG.\n\n##### filePath\n\nType: `string`\n\nThe file path to the image.\n\n## Build-system integration\n\nDon't use this with a build-system like Gulp/Grunt as you can easily make the images progressive with the [`imagemin`](https://github.com/imagemin/imagemin) *([Gulp](https://github.com/sindresorhus/gulp-imagemin)/[Grunt](https://github.com/gruntjs/grunt-contrib-imagemin)-task)* `progressive` option instead of just warning about it.\n\n## Related\n\n- [is-progressive-cli](https://github.com/sindresorhus/is-progressive-cli) - CLI for this module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fis-progressive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fis-progressive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fis-progressive/lists"}