user92357: I am working in js and I need a library that helps me get an address from a public key stored in a buffer format.

user60443: Try bitcoinjs-lib
The following will generate a P2SH(P2WPKH) address
const bitcoin = require('bitcoinjs-lib')
let pubkey = Buffer.from('027a2c8c567a5bb7777580d31d1fd8d9910d4b1bb398570e3a36e81d7522cf828a', 'hex')
let address = bitcoin.payments.p2sh({redeem: bitcoin.payments.p2wpkh({ pubkey })}).address
console.log('address: ', address)

address:  3F1JMjuxgNFuK4kBxv4JXMEdQ2yvjuz939


92357: <p>I am working in js and I need a library that helps me get an address from a public key stored in a buffer format.</p>
 60443: <p>Try <a href="https://github.com/bitcoinjs/bitcoinjs-lib" rel="nofollow noreferrer">bitcoinjs-lib</a></p>

<p>The following will generate a <code>P2SH(P2WPKH)</code> address</p>

<pre><code>const bitcoin = require('bitcoinjs-lib')
let pubkey = Buffer.from('027a2c8c567a5bb7777580d31d1fd8d9910d4b1bb398570e3a36e81d7522cf828a', 'hex')
let address = bitcoin.payments.p2sh({redeem: bitcoin.payments.p2wpkh({ pubkey })}).address
console.log('address: ', address)

address:  3F1JMjuxgNFuK4kBxv4JXMEdQ2yvjuz939
</code></pre>
