fileWriter

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

k6filewriter

xk6 Module for creating and writing/logging strings into local files during a loadtest with k6. If the directories and subdirectories do not exist, the writeString() function will create them and the file with permission bits 0750. However, if they exist, the writeString() method will act like the appendString() method. The appendString() function will just add the respective string into the end of the file.

Installation

To use the module, you need to build k6 with this module. To archieve this you need xk6. If you have installed it successfully, you can build your k6 with the module with the command below:

xk6 build --with github.com/Shaedow4/k6filewriter

Usage in code

To use the module in your k6 Javascript code, import the module with the following line and call the writeString() and appendString() method

import filewriter from "k6/x/filewriter";

//create a new file and write a string
filewriter.writeString("path", "filename", "myAddedString")

//append to an existing file
filewriter.appendString("path", "filename", "myAddedString")

License: Apache License 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileWriter

type FileWriter struct{}

func (*FileWriter) AppendString

func (d *FileWriter) AppendString(path string, filename string, s string) error

func (*FileWriter) WriteString

func (d *FileWriter) WriteString(path string, filename string, s string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL