@@ -14,24 +14,20 @@ way modeled on standard POSIX functions.
1414To use the promise-based APIs:
1515
1616``` mjs
17- // Using ESM Module syntax:
1817import * as fs from ' fs/promises' ;
1918```
2019
2120``` cjs
22- // Using CommonJS syntax:
2321const fs = require (' fs/promises' );
2422```
2523
2624To use the callback and sync APIs:
2725
2826``` mjs
29- // Using ESM Module syntax:
3027import * as fs from ' fs' ;
3128```
3229
3330``` cjs
34- // Using CommonJS syntax:
3531const fs = require (' fs' );
3632```
3733
@@ -44,7 +40,6 @@ Promise-based operations return a promise that is fulfilled when the
4440asynchronous operation is complete.
4541
4642``` mjs
47- // Using ESM Module syntax:
4843import { unlink } from ' fs/promises' ;
4944
5045try {
5651```
5752
5853``` cjs
59- // Using CommonJS syntax
6054const { unlink } = require (' fs/promises' );
6155
6256(async function (path ) {
@@ -78,7 +72,6 @@ reserved for an exception. If the operation is completed successfully, then
7872the first argument is ` null ` or ` undefined ` .
7973
8074``` mjs
81- // Using ESM syntax
8275import { unlink } from ' fs' ;
8376
8477unlink (' /tmp/hello' , (err ) => {
@@ -88,7 +81,6 @@ unlink('/tmp/hello', (err) => {
8881```
8982
9083``` cjs
91- // Using CommonJS syntax
9284const { unlink } = require (' fs' );
9385
9486unlink (' /tmp/hello' , (err ) => {
@@ -108,7 +100,6 @@ execution until the operation is complete. Exceptions are thrown immediately
108100and can be handled using ` try…catch ` , or can be allowed to bubble up.
109101
110102``` mjs
111- // Using ESM syntax
112103import { unlinkSync } from ' fs' ;
113104
114105try {
@@ -120,7 +111,6 @@ try {
120111```
121112
122113``` cjs
123- // Using CommonJS syntax
124114const { unlinkSync } = require (' fs' );
125115
126116try {
@@ -6316,7 +6306,6 @@ It is important to correctly order the operations by awaiting the results
63166306of one before invoking the other:
63176307
63186308` ` ` mjs
6319- // Using ESM syntax
63206309import { rename , stat } from ' fs/promises' ;
63216310
63226311const from = ' /tmp/hello' ;
@@ -6332,7 +6321,6 @@ try {
63326321` ` `
63336322
63346323` ` ` cjs
6335- // Using CommonJS syntax
63366324const { rename , stat } = require (' fs/promises' );
63376325
63386326(async function (from , to ) {
0 commit comments