/xk6-filenio

Primary LanguageGoApache License 2.0Apache-2.0

xk6-file

k6 extension for writing files, implemented using the xk6 system.

Build

xk6 build v0.36.0 --with github.com/sealr00t/xk6-filenio@latest

Example

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);
}

Run sample script

./k6 run sample-script.js