Skip to content

Commit 438fc1b

Browse files
Apply suggestions from code review
Co-authored-by: Heitor Tashiro Sergent <[email protected]>
1 parent 487a3db commit 438fc1b

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'k6/experimental'
3-
excerpt: 'k6 experimental APIs'
3+
description: 'k6 experimental APIs'
44
weight: 07
55
---
66

@@ -11,10 +11,10 @@ weight: 07
1111
| Modules | Description |
1212
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
1313
| [browser](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser) | Provides browser-level APIs to interact with browsers and collect frontend performance metrics as part of your k6 tests. |
14+
| [fs](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs) | Provides a memory-efficient way to handle file interactions within your test scripts. |
15+
| [grpc](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/grpc) | Extends `k6/net/grpc` with the streaming capabilities. |
1416
| [redis](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/redis) | Functionality to interact with [Redis](https://redis.io/). |
1517
| [timers](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/timers) | `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` |
1618
| [tracing](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/tracing) | Support for instrumenting HTTP requests with tracing information. |
1719
| [webcrypto](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/webcrypto) | Implements the [WebCrypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API). |
1820
| [websockets](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/websockets) | Implements the browser's [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket). |
19-
| [grpc](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/grpc) | Extends `k6/net/grpc` with the streaming capabilities. |
20-
| [fs](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs) | Provides a memory-efficient way to handle file interactions within your test scripts. |

docs/sources/next/javascript-api/k6-experimental/fs/FileInfo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'FileInfo'
3-
excerpt: 'FileInfo represents information about a file.'
3+
description: 'FileInfo represents information about a file.'
44
weight: 30
55
---
66

@@ -28,7 +28,7 @@ let file;
2828
})();
2929

3030
export default async function () {
31-
// About information about the file
31+
// Retrieve information about the file
3232
const fileinfo = await file.stat();
3333
if (fileinfo.name != 'bonjour.txt') {
3434
throw new Error('Unexpected file name');

docs/sources/next/javascript-api/k6-experimental/fs/SeekMode.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: 'SeekMode'
3-
excerpt: 'SeekMode is used to specify the position from which to seek in a file.'
3+
description: 'SeekMode is used to specify the position from which to seek in a file.'
44
weight: 40
55
---
66

77
# SeekMode
88

9-
The `SeekMode` enum is used to specify the position from which to [seek](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file/seek) in a file.
9+
The `SeekMode` enum specifies the position from which to [seek](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file/seek) in a file.
1010

1111
## Members
1212

docs/sources/next/javascript-api/k6-experimental/fs/_index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
title: 'fs'
3-
excerpt: 'k6 fs experimental API'
3+
description: 'k6 fs experimental API'
44
weight: 10
55
---
66

77
# fs
88

99
{{< docs/shared source="k6" lookup="experimental-module.md" version="<K6_VERSION>" >}}
1010

11-
The k6 filesystem experimental module provides a memory-efficient way to handle file interactions within your test scripts. It currently offers support for opening files, reading their content, and seeking through their content, and retrieving metadata about them.
11+
The k6 filesystem experimental module provides a memory-efficient way to handle file interactions within your test scripts. It currently offers support for opening files, reading their content, seeking through their content, and retrieving metadata about them.
1212

1313
### Memory efficiency
1414

1515
One of the key advantages of the filesystem module is its memory efficiency. Unlike the traditional [open](https://grafana.com/docs/k6/latest/javascript-api/init-context/open/) function, which loads a file multiple times into memory, the filesystem module reduces memory usage by loading the file as little possible, and sharing the same memory space between all VUs. This approach reduces the risk of encountering out-of-memory errors, especially in load tests involving large files.
1616

1717
### Notes on usage
1818

19-
An important consideration when using the filesystem module is its handling of external file modifications. Once a file is loaded in k6, it behaves like a "view" over the content of the file. This means that if the underlying file is modified externally during a test, those changes won't be reflected in the loaded [File](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file/) instance.
19+
An important consideration when using the filesystem module is its handling of external file modifications. Once k6 loads a file, it behaves like a "view" over its contents. If you modify the underlying file during a test, k6 will not reflect those changes in the loaded [File](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file/) instance.
2020

2121
## API Overview
2222

docs/sources/next/javascript-api/k6-experimental/fs/file/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'File'
3-
excerpt: 'File represents a file with methods for reading, seeking, and obtaining file stats.'
3+
description: 'File represents a file with methods for reading, seeking, and obtaining file stats.'
44
weight: 10
55
---
66

@@ -20,7 +20,7 @@ The `File` class represents a file with methods for reading, seeking, and obtain
2020
| :------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- |
2121
| [read](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file/read) | Reads up to `buffer.byteLength` bytes from the file into the passed `buffer`. Returns a promise resolving to the number of bytes read. |
2222
| [seek](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file/seek) | Sets the file position indicator for the file to the passed `offset` bytes. Returns a promise resolving to the new offset. |
23-
| [stat](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file/stat) | Returns a promise resolving to a [FileInfo](link-to-fileinfo-doc) object with information about the file. |
23+
| [stat](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file/stat) | Returns a promise resolving to a [FileInfo](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/fileinfo/) object with information about the file. |
2424

2525
## Example
2626

docs/sources/next/javascript-api/k6-experimental/fs/file/read.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'read'
3-
excerpt: 'the read method is used to read a chunk of the file.'
3+
description: 'the read method is used to read a chunk of the file.'
44
weight: 20
55
---
66

docs/sources/next/javascript-api/k6-experimental/fs/file/seek.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'seek'
3-
excerpt: 'seek sets the file position indicator for the file to the passed offset bytes.'
3+
description: 'seek sets the file position indicator for the file to the passed offset bytes.'
44
weight: 30
55
---
66

docs/sources/next/javascript-api/k6-experimental/fs/file/stat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'stat'
3-
excerpt: 'stat returns a promise resolving to a FileInfo object with information about the file.'
3+
description: 'stat returns a promise resolving to a FileInfo object with information about the file.'
44
weight: 40
55
---
66

docs/sources/next/javascript-api/k6-experimental/fs/open.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: 'open'
3-
excerpt: 'open opens a file and returns a promise resolving to a File instance.'
3+
description: 'open opens a file and returns a promise resolving to a File instance.'
44
weight: 20
55
---
66

77
# open
88

99
The `open` function opens a file and returns a promise that resolves to a [File](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/fs/file) instance. Unlike the traditional [open](https://grafana.com/docs/k6/latest/javascript-api/init-context/open/) function, which loads a file multiple times into memory, the filesystem module reduces memory usage by loading the file as little possible, and sharing the same memory space between all VUs. This approach reduces the risk of encountering out-of-memory errors, especially in load tests involving large files.
1010

11-
### Asynchronous Nature
11+
### Asynchronous nature
1212

1313
It's important to note that `open` is asynchronous and returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). Due to k6's current limitation with the Init context (which doesn't support asynchronous functions directly), you need to use an asynchronous wrapper like this:
1414

0 commit comments

Comments
 (0)