Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reklatsmasters/pem-file
PEM file format encoder/decoder.
https://github.com/reklatsmasters/pem-file
crypto js node nodejs pem
Last synced: 24 days ago
JSON representation
PEM file format encoder/decoder.
- Host: GitHub
- URL: https://github.com/reklatsmasters/pem-file
- Owner: reklatsmasters
- License: mit
- Created: 2018-05-04T05:54:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-15T19:38:47.000Z (almost 6 years ago)
- Last Synced: 2024-10-10T14:15:02.455Z (28 days ago)
- Topics: crypto, js, node, nodejs, pem
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
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)) //
``````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