k6 extension for writing files, implemented using the xk6 system.
xk6 build v0.36.0 --with github.com/sealr00t/xk6-filenio@latest
import file from 'k6/x/filenio';
const filepath = 'sample-output.txt';
export default function () {
file.writeString(filepath, 'New file. First line.\n');
file.appendString(filepath, `Second line. VU: ${__VU} - ITER: ${__ITER}`);
file.removeLines(filepath, 1, 1);
}
./k6 run sample-script.js