Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jonschlinkert/is-corrupted-jpeg

Returns true if a file appears to be a corrupted jpeg image file and is corrupted.
https://github.com/jonschlinkert/is-corrupted-jpeg

corrupted file javascript jpeg jpg node nodejs

Last synced: 2 months ago
JSON representation

Returns true if a file appears to be a corrupted jpeg image file and is corrupted.

Awesome Lists containing this project

README

        

# is-corrupted-jpeg [![NPM version](https://img.shields.io/npm/v/is-corrupted-jpeg.svg?style=flat)](https://www.npmjs.com/package/is-corrupted-jpeg) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-corrupted-jpeg.svg?style=flat)](https://npmjs.org/package/is-corrupted-jpeg) [![NPM total downloads](https://img.shields.io/npm/dt/is-corrupted-jpeg.svg?style=flat)](https://npmjs.org/package/is-corrupted-jpeg) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-corrupted-jpeg.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-corrupted-jpeg)

> Returns true if a file appears to be a corrupted jpeg image file and is corrupted.

Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save is-corrupted-jpeg
```

## How reliable is this?

This will not be correct 100% of the time. This library only returns `true` when the jpeg's dimensions are undefined. However, it's possible for a jpeg to be corrupted whilst still having readable dimensions.

## Usage

Takes a filepath to a `.jpg` or `.jpeg` file (case insensitive).

```js
var isCorrupted = require('is-corrupted-jpeg');
console.log(isCorrupted('./path/to/image/not-corrupted.jpg'));
//=> true
console.log(isCorrupted('./path/to/image/corrupted.jpg'));
//=> false
```

## About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

### Related projects

You might also be interested in these projects:

* [fs-utils](https://www.npmjs.com/package/fs-utils): fs extras and utilities to extend the node.js file system module. Used in Assemble and… [more](https://github.com/assemble/fs-utils) | [homepage](https://github.com/assemble/fs-utils "fs extras and utilities to extend the node.js file system module. Used in Assemble and many other projects.")
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on November 02, 2017._