File tree Expand file tree Collapse file tree 1 file changed +0
-27
lines changed
docs/sources/next/javascript-api/k6-experimental/fs Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Original file line number Diff line number Diff line change @@ -34,33 +34,6 @@ export default async function () {
3434 throw new Error (' Unexpected file name' );
3535 }
3636
37- const buffer = new Uint8Array (4 );
38-
39- let totalBytesRead = 0 ;
40- while (true ) {
41- // Read into the buffer
42- const bytesRead = await file .read (buffer);
43- if (bytesRead == null ) {
44- // EOF
45- break ;
46- }
47-
48- // Do something useful with the content of the buffer
49- totalBytesRead += bytesRead;
50-
51- // If bytesRead is less than the buffer size, we've read the whole file
52- if (bytesRead < buffer .byteLength ) {
53- break ;
54- }
55- }
56-
57- // Check that we read the expected number of bytes
58- if (totalBytesRead != fileinfo .size ) {
59- throw new Error (' Unexpected number of bytes read' );
60- }
61-
62- // Seek back to the beginning of the file
63- await file .seek (0 , SeekMode .Start );
6437}
6538```
6639
You can’t perform that action at this time.
0 commit comments