Socket
Socket
Sign inDemoInstall

pem-jwk

Package Overview
Dependencies
22
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.4.0

46

bin/pem-jwk.js
#!/usr/bin/env node
var path = require('path')
var fs = require('fs')
var pj = require('../index')
var filename = process.argv[2]
if (!filename) {
//TODO: use stdin
console.error("Missing filename\nUsage:\n\tpem-jwk [filename]")
process.exit(1)
function convert(str) {
if (str[0] === '{') {
console.log(pj.jwk2pem(JSON.parse(str)))
}
else {
console.log(pj.pem2jwk(str))
}
}
var filepath = path.resolve(process.cwd(), filename)
try {
var file = fs.readFileSync(filepath, 'utf8')
}
catch (e) {
console.error('Could not read file: %s', filepath)
process.exit(1)
}
if (file[0] === '{') {
console.log(pj.jwk2pem(JSON.parse(file)))
if (!filename) {
var chunks = []
process.stdin.on('readable', function() {
var chunk = process.stdin.read()
if (chunk !== null) {
chunks.push(chunk)
}
})
process.stdin.on('end', function () {
convert(Buffer.concat(chunks).toString('utf8'))
})
}
else {
console.log(pj.pem2jwk(file))
var path = require('path')
var fs = require('fs')
var filepath = path.resolve(process.cwd(), filename)
try {
convert(fs.readFileSync(filepath, 'utf8'))
}
catch (e) {
console.error('Could not read file: %s', filepath)
process.exit(1)
}
}
{
"name": "pem-jwk",
"version": "1.3.0",
"version": "1.4.0",
"main": "index.js",

@@ -5,0 +5,0 @@ "bin": "./bin/pem-jwk.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc