Try to use imagemagick npm module.
Need to convert a .png file with transparent background to .jpeg with white background.
Example:
const ImageMagick = require('imagemagick');
ImageMagick.convert(
[
'source_file.png',
'destination_file.jpg'
],
function(err, stdout){}
);
The result: destination file is saved with black background.
Didn't find needed option to resolve this issue.
P.S. For example PHP can do this by using imagecolorallocate() and imagefill() functions.