Downsampling PCM Audio
Breaking down the conversion into an upsampling and a downsampling step as explained in mbaz's answer is not necessary - band-limited interpolation achieves the same result in one single process, for any conversion ratio, and its quality is easy to fine-tune (through various approximations of the band-limited pulse).

libsamplerate is an example of open-source implementation that does not rely on upsampling/downsampling. It should be possible to bind it to NodeJS through an add-on, or even to rewrite it in javascript - once stripped of the code handling corner cases (variable rate, compensation of processing delay), the code fits in a 50-line loop.