Is getting my Public IP address using node js( child_process ) is good idea?

Getting my Public IP address using Node js child_process

const { exec } = require('child_process')

exec('curl ip-adresim.app', function(error, stdout, stderr){
    if(error)
        return;
    console.log('your ip is :'+ stdout);
})

Is this good idea ?