I am using xmlbuilder2 and noticed something strange when I console.log the output. The following code will produce a reasonably large xml string but when logged it will remove a large part of the xml from the middle, replacing it with what looks like three dots ... but is actually one character … and repeat that character at the end.
The stranger thing is that when I use VSC's Debug Console to print the output I get the perfectly constructed xml.
const output = doc.end({ prettyPrint: true });
console.log(output);
Example:
<TXLife><MoreTags>5Y10-XA…<FormName><MoreTags></TXLife>…
Any thoughts on why this happens?
Use:
process.stdout.write(output + '\n');
instead.
console.log truncates data that is too long (I'm not sure what the max length of data can be before it truncates.
This happens because console.log uses util.inspect which produces output intended for debugging.