# pnm-convertor

> [![npm version](https://badge.fury.io/js/pnm-convertor.svg)](https://badge.fury.io/js/pnm-convertor)

Latest version **1.0.3** (published 2020-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install pnm-convertor
pnpm add pnm-convertor
yarn add pnm-convertor
bun add pnm-convertor
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-06-05 |
| First published | 2020-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Yezhi |
| Maintainers | yezhi.chen |

## Links

- npm: https://www.npmjs.com/package/pnm-convertor
- Repository: https://github.com/yezhi780625/pnm-convertor
- Homepage: https://github.com/yezhi780625/pnm-convertor#readme
- Issues: https://github.com/yezhi780625/pnm-convertor/issues
- npm.io page: https://npm.io/package/pnm-convertor

## Recent versions

- 1.0.3 (latest) — 2020-06-05
- 1.0.2 — 2020-06-05
- 1.0.1 — 2020-06-02
- 1.0.0 — 2020-05-30

## README

# PNM Convertor
[![npm version](https://badge.fury.io/js/pnm-convertor.svg)](https://badge.fury.io/js/pnm-convertor)

Simple `promise` function to convert `.pbm`, `.pgm.` or `.ppm` file to image format (The default format type is `image/png`).

## Installation

```bash
 # with npm
npm install pnm-convertor
# with yarn
yarn add pnm-convertor
```

## Usage

```js
// React
import React, { memo, useState, useCallback } from 'react';
import convert from 'pnm-convertor';

const Demo = () => {
  const [image, setImage] = useState(null);
  const onChange = useCallback(async (e) => {
    const files = e.target.files;
    const file = await convert(files[0]);
    setImage(file);
  }, []);
  return (
    <div>
      <input type="file" onChange={onChange} />
      {image && <img src={image} alt="upload" />}
    </div>
  );
};

export default memo(Demo);
```

---
_Source: https://npm.io/package/pnm-convertor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
