Skip to content

Commit

Permalink
squash: adjust example
Browse files Browse the repository at this point in the history
  • Loading branch information
LiviaMedeiros committed Jun 9, 2022
1 parent 9d86e22 commit 84889a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,15 @@ Use of this function is encouraged for relevant regression tests and for new
APIs that work with user-provided objects.

```mjs
import { promises as fs } from 'node:fs';
import { open } from 'node:fs/promises';
import { mustNotMutate } from '../common/index.mjs';

const _mutableOptions = { length: 4, position: 8 };
const options = mustNotMutate(_mutableOptions);

// In filehandle.read or filehandle.write attempt to mutate options will throw
// In filehandle.read or filehandle.write, attempt to mutate options will throw
// In the test code, options can still be mutated via _mutableOptions
const fh = await fs.open('/path/to/file', 'r+');
const fh = await open('/path/to/file', 'r+');
const { buffer } = await fh.read(options);
_mutableOptions.position = 4;
await fh.write(buffer, options);
Expand Down

0 comments on commit 84889a5

Please sign in to comment.