# pem-file

> PEM file format encoder/decoder.

Latest version **1.0.1** (published 2018-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install pem-file
pnpm add pem-file
yarn add pem-file
bun add pem-file
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-12-15 |
| First published | 2018-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Dmitriy Tsvettsikh |
| Maintainers | reklatsmasters |
| Keywords | pem, rsa, private, public, key |

## Links

- npm: https://www.npmjs.com/package/pem-file
- Repository: https://github.com/reklatsmasters/pem-file
- Homepage: https://github.com/reklatsmasters/pem-file#readme
- Issues: https://github.com/reklatsmasters/pem-file/issues
- npm.io page: https://npm.io/package/pem-file

## Recent versions

- 1.0.1 (latest) — 2018-12-15
- 1.0.0 — 2018-05-04

## README

# pem-file

[![Build Status](https://travis-ci.org/reklatsmasters/pem-file.svg?branch=master)](https://travis-ci.org/reklatsmasters/pem-file)
[![npm](https://img.shields.io/npm/v/pem-file.svg)](https://npmjs.org/package/pem-file)
[![node](https://img.shields.io/node/v/pem-file.svg)](https://npmjs.org/package/pem-file)
[![license](https://img.shields.io/npm/l/pem-file.svg)](https://npmjs.org/package/pem-file)
[![downloads](https://img.shields.io/npm/dm/pem-file.svg)](https://npmjs.org/package/pem-file)
[![Coverage Status](https://coveralls.io/repos/github/reklatsmasters/pem-file/badge.svg?branch=master)](https://coveralls.io/github/reklatsmasters/pem-file?branch=master)


PEM file format encoder/decoder.

## Usage

```js
const fs = require('fs')
const pem = require('pem-file')

const file = fs.readFileSync('./pubkey.pem')
console.log(pem.decode(file)) // <Buffer 30 82 ...>
```

```js
const pem = require('pem-file')
const source = Buffer.from('12345')

console.log(pem.encode(source, 'DATA'))
// Output:
// -----BEGIN DATA-----
// MTIzNDU=
// -----END DATA-----
```

## API

* `encode(source: Buffer, label: string): string`

Convert data to PEM format.

* `decode(pem: Buffer | String): Buffer`

Convert PEM formatted data to raw buffer.

## License

MIT, 2018 (c) Dmitriy Tsvettsikh

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