Since it is supposed to be executed in Node.js, it will be JavaScript code. If you type the same command on the command line, you can execute it other than Node.js.
const { execSync } = require('child_process');
function Insert_haed_blank(input, duration, output)
{
  execSync(`ffmpeg -i ${input} -vf tpad=start_duration=${duration}:color=black -af "adelay=${duration}s:all=1" ${output}`);
}
--input: Input video path -duration: Silent black screen time to insert (seconds) --output: Output video path
-vf tpad = start_duration = $ {duration}: color = black is video,
-af" adelay = $ {duration} s: all = 1 " is the audio setting.
If you want to specify the silent black screen period to insert by the number of frames, change tpad = start_duration = to tpad = start =.
If you want to insert a white screen, change color = black to color = white.
ʻAdelay = $ {duration} s delays the start of audio by duration seconds.  ʻAll = 1 specifies all audio channels.
const { execSync } = require('child_process');
function Insert_end_blank(input, duration, output)
{
  execSync(`ffmpeg -i ${input} -vf tpad=stop_duration=${duration}:color=black -af "apad=pad_dur=${duration}" ${output}`);
}
Same as before
-vf tpad = stop_duration = $ {duration}: color = black is video,
-af" apad = pad_dur = $ {duration} " is the audio setting.
If you want to specify the silent black screen period to insert by the number of frames, change tpad = stop_duration = to tpad = stop =.