Is there any kind of built-in function or formula that I can use to conveniently compute the (effective) bandwidth and (effective) duration of a given digital signal with known sampling frequency?
The answer is no. The bandwidth of a digital signal is half of the sample rate. The seconds of duration is the total number of samples divided by the sample rate. The sample rate is whatever you say it is - there is no way of decoding it from a signal. Analogously, it's a bit like determining the weight of an object without a scale. However, if you happen to know something about the frequency content of the signal then you could derive it's sample rate through analysis. For example, if you know the signal was a 1kHz sine wave, and you looked at the file and saw a sine wave that had a 48 sample period then you could assume the sample rate was 48000 since 48 samples is 1ms. In the weight analogy this would be akin to knowing the density and volume and then computing the weight from that.