expandCidr
now returns a generator instead of array to enable immediate consumption of generated IPs and eliminate a potential memory/performance problem in the module. To migrate previous Array use cases:
expandCidr(nets)
-> Array.from(expandCidr(nets))
Be aware that passing large networks that contain millions of IPs can result in memory exhaustion and slow execution time. It's recommended to validate the amount of IPs first, for example, like this:
const {start, end} = parseCidr(net);
if (end - start >= 1000000n) {
throw new Error("Too many IPs");
}