Closed wsierakowski closed 9 months ago
According to the documentation, the "printResult" function is supposed to 'Print the result tables to the terminal.' However, upon reviewing the code, it appears that it doesn't actually print anything to the terminal; instead, it only returns a string containing the result table. The "outputStream" option is only used to determine whether the terminal supports color. You can see it here.
To print the result to the terminal, use the value returned by the function. For example:
const { stdout } = require("node:process");
const autocannon = require("autocannon");
const test = async () => {
const result = await autocannon({
url: "https://google.com",
connections: 10, //default
pipelining: 1, // default
duration: 10, // default
});
stdout.write(autocannon.printResult(result));
};
test();
I have the following script:
This prints nothing on the screen. Why?