Skip to content

Commit

Permalink
add comments and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
avitalique committed Jul 14, 2023
1 parent a4db2ab commit 101a398
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
package file

import (
"os"
"bufio"

"os"

"go.k6.io/k6/js/modules"
)

Expand All @@ -18,7 +18,7 @@ func init() {
// FILE is the k6 extension
type FILE struct{}

// Write string to file
// WriteString writes string to file
func (*FILE) WriteString(path string, s string) error {
f, err := os.Create(path)
if err != nil {
Expand All @@ -32,7 +32,7 @@ func (*FILE) WriteString(path string, s string) error {
return nil
}

// Append string to file
// AppendString appends string to file
func (*FILE) AppendString(path string, s string) error {
f, err := os.OpenFile(path,
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
Expand All @@ -47,12 +47,12 @@ func (*FILE) AppendString(path string, s string) error {
return nil
}

// WriteBytes writes binary file
func (*FILE) WriteBytes(path string, b []byte) error {
err := os.WriteFile(path, b, 0644)
if err != nil {
return err
}

return nil
}

Expand All @@ -70,7 +70,7 @@ func (*FILE) ClearFile(path string) error {
return nil
}

// DeleteFile delete file
// DeleteFile deletes file
func (*FILE) DeleteFile(path string) error {
err := os.Remove(path)
if err != nil {
Expand Down

0 comments on commit 101a398

Please sign in to comment.