pem-file
v1.0.1
Published
PEM file format encoder/decoder.
Downloads
8,421
Maintainers
Readme
pem-file
PEM file format encoder/decoder.
Usage
const fs = require('fs')
const pem = require('pem-file')
const file = fs.readFileSync('./pubkey.pem')
console.log(pem.decode(file)) // <Buffer 30 82 ...>
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