Tệp JavaScript io

Mô-đun

import { open } from 'node:fs/promises';

const fd = await open['sample.txt'];
fd.createReadStream[{ start: 90, end: 99 }];
4 cho phép tương tác với hệ thống tệp theo cách được mô hình hóa trên các chức năng POSIX tiêu chuẩn

Để sử dụng các API dựa trên lời hứa

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];

Để sử dụng API gọi lại và đồng bộ hóa

import * as fs from 'node:fs';const fs = require['node:fs'];

Tất cả các hoạt động của hệ thống tệp đều có biểu mẫu đồng bộ, gọi lại và dựa trên lời hứa và có thể truy cập bằng cả cú pháp CommonJS và Mô-đun ES6 [ESM]

Ví dụ về lời hứa

Các hoạt động dựa trên lời hứa trả về một lời hứa được thực hiện khi hoạt động không đồng bộ hoàn tất

import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];

ví dụ gọi lại

Biểu mẫu gọi lại lấy hàm gọi lại hoàn thành làm đối số cuối cùng của nó và gọi hoạt động không đồng bộ. Các đối số được truyền cho lệnh gọi lại hoàn thành phụ thuộc vào phương thức, nhưng đối số đầu tiên luôn được dành riêng cho một ngoại lệ. Nếu thao tác hoàn tất thành công, thì đối số đầu tiên là

import { open } from 'node:fs/promises';

const fd = await open['sample.txt'];
fd.createReadStream[{ start: 90, end: 99 }];
5 hoặc
import { open } from 'node:fs/promises';

const fd = await open['sample.txt'];
fd.createReadStream[{ start: 90, end: 99 }];
6

import { unlink } from 'node:fs';

unlink['/tmp/hello', [err] => {
  if [err] throw err;
  console.log['successfully deleted /tmp/hello'];
}];const { unlink } = require['node:fs'];

unlink['/tmp/hello', [err] => {
  if [err] throw err;
  console.log['successfully deleted /tmp/hello'];
}];

Các phiên bản dựa trên gọi lại của API mô-đun

import { open } from 'node:fs/promises';

const fd = await open['sample.txt'];
fd.createReadStream[{ start: 90, end: 99 }];
4 được ưu tiên sử dụng hơn so với việc sử dụng các API hứa hẹn khi hiệu suất tối đa [cả về thời gian thực hiện và cấp phát bộ nhớ] là bắt buộc

ví dụ đồng bộ

Các API đồng bộ chặn Nút. js và thực thi JavaScript tiếp theo cho đến khi thao tác hoàn tất. Các ngoại lệ được đưa ra ngay lập tức và có thể được xử lý bằng cách sử dụng

import { open } from 'node:fs/promises';

const fd = await open['sample.txt'];
fd.createReadStream[{ start: 90, end: 99 }];
8 hoặc có thể được phép nổi lên

API lời hứa

Lịch sửPhiên bảnChangesv14. 0. 0

tiếp xúc như

import { open } from 'node:fs/promises';

const fd = await open['sample.txt'];
fd.createReadStream[{ start: 90, end: 99 }];
9

v11. 14. 0, v10. 17. 0

API này không còn thử nghiệm nữa

v10. 1. 0

Chỉ có thể truy cập API qua

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
00

v10. 0. 0

Đã thêm vào. v10. 0. 0

API

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
01 cung cấp các phương thức hệ thống tệp không đồng bộ trả về lời hứa

Các API lời hứa sử dụng Nút bên dưới. js để thực hiện các hoạt động của hệ thống tệp ngoài luồng vòng lặp sự kiện. Các hoạt động này không được đồng bộ hóa hoặc luồng an toàn. Phải cẩn thận khi thực hiện nhiều sửa đổi đồng thời trên cùng một tệp, nếu không có thể xảy ra lỗi dữ liệu

Lớp.
import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
02

Một đối tượng là một trình bao bọc đối tượng cho một bộ mô tả tệp số

Thể hiện của đối tượng được tạo bằng phương thức

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
03

Tất cả các đối tượng là s

Nếu a không được đóng bằng phương pháp

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
04, nó sẽ cố gắng tự động đóng bộ mô tả tệp và đưa ra cảnh báo quy trình, giúp ngăn rò rỉ bộ nhớ. Vui lòng không dựa vào hành vi này vì nó có thể không đáng tin cậy và tệp có thể không được đóng. Thay vào đó, luôn luôn đóng s một cách rõ ràng. Nút. js có thể thay đổi hành vi này trong tương lai

Biến cố.
import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
05

Sự kiện

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
05 được phát ra khi đã đóng và không thể sử dụng được nữa

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
07

Lịch sửPhiên bảnThay đổiv15. 14. 0, v14. 18. 0

Đối số

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
08 hỗ trợ
import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
09,
import * as fs from 'node:fs';const fs = require['node:fs'];
00 và
import * as fs from 'node:fs';const fs = require['node:fs'];
01

v14. 0. 0

Tham số

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
08 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

v10. 0. 0

Đã thêm vào. v10. 0. 0

Bí danh của

Khi thao tác trên các bộ điều khiển tệp, không thể thay đổi chế độ so với chế độ đã đặt với. Do đó, điều này tương đương với

import * as fs from 'node:fs';const fs = require['node:fs'];
06

Sửa đổi các quyền trên tệp. Xem

import * as fs from 'node:fs';const fs = require['node:fs'];
07

import * as fs from 'node:fs';const fs = require['node:fs'];
08
  • import * as fs from 'node:fs';const fs = require['node:fs'];
    09 Id người dùng của chủ sở hữu mới của tệp
  • import * as fs from 'node:fs';const fs = require['node:fs'];
    70 Id nhóm của nhóm mới của tệp
  • trả lại. Hoàn thành với
    import { open } from 'node:fs/promises';
    
    const fd = await open['sample.txt'];
    fd.createReadStream[{ start: 90, end: 99 }];
    6 khi thành công

Thay đổi quyền sở hữu của tập tin. Một trình bao bọc cho

import * as fs from 'node:fs';const fs = require['node:fs'];
72

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
04
  • trả lại. Hoàn thành với
    import { open } from 'node:fs/promises';
    
    const fd = await open['sample.txt'];
    fd.createReadStream[{ start: 90, end: 99 }];
    6 khi thành công

Đóng bộ điều khiển tệp sau khi đợi bất kỳ thao tác đang chờ xử lý nào trên bộ điều khiển hoàn tất

import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];
2
import * as fs from 'node:fs';const fs = require['node:fs'];
75

Không giống như 16 KiB mặc định

import * as fs from 'node:fs';const fs = require['node:fs'];
76 cho a , luồng được phương pháp này trả về có một
import * as fs from 'node:fs';const fs = require['node:fs'];
76 mặc định là 64 KiB

import * as fs from 'node:fs';const fs = require['node:fs'];
78 có thể bao gồm các giá trị
import * as fs from 'node:fs';const fs = require['node:fs'];
79 và
import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];
80 để đọc một phạm vi byte từ tệp thay vì toàn bộ tệp. Cả
import * as fs from 'node:fs';const fs = require['node:fs'];
79 và
import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];
80 đều bao gồm và bắt đầu đếm từ 0, các giá trị được phép nằm trong phạm vi [0,
import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];
83]. Nếu
import * as fs from 'node:fs';const fs = require['node:fs'];
79 bị bỏ qua hoặc
import { open } from 'node:fs/promises';

const fd = await open['sample.txt'];
fd.createReadStream[{ start: 90, end: 99 }];
6, thì
import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];
86 sẽ đọc tuần tự từ vị trí tệp hiện tại.
import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];
87 có thể là bất kỳ một trong số đó được chấp nhận bởi

Nếu

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
02 trỏ đến một thiết bị ký tự chỉ hỗ trợ chặn đọc [chẳng hạn như bàn phím hoặc card âm thanh], thì thao tác đọc sẽ không kết thúc cho đến khi có dữ liệu. Điều này có thể ngăn quá trình thoát và luồng đóng tự nhiên

Theo mặc định, luồng sẽ phát ra sự kiện

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
05 sau khi nó bị hủy. Đặt tùy chọn
import * as fs from 'node:fs';const fs = require['node:fs'];
00 thành
import * as fs from 'node:fs';const fs = require['node:fs'];
01 để thay đổi hành vi này

Nếu

import * as fs from 'node:fs';const fs = require['node:fs'];
02 là sai, thì bộ mô tả tệp sẽ không bị đóng, ngay cả khi có lỗi. Ứng dụng có trách nhiệm đóng nó và đảm bảo không có rò rỉ bộ mô tả tệp. Nếu
import * as fs from 'node:fs';const fs = require['node:fs'];
02 được đặt thành true [hành vi mặc định], trên
import * as fs from 'node:fs';const fs = require['node:fs'];
04 hoặc
import * as fs from 'node:fs';const fs = require['node:fs'];
05, bộ mô tả tệp sẽ tự động bị đóng

Một ví dụ để đọc 10 byte cuối cùng của tệp dài 100 byte

import { open } from 'node:fs/promises';

const fd = await open['sample.txt'];
fd.createReadStream[{ start: 90, end: 99 }];
import * as fs from 'node:fs';const fs = require['node:fs'];
06

import * as fs from 'node:fs';const fs = require['node:fs'];
78 cũng có thể bao gồm tùy chọn
import * as fs from 'node:fs';const fs = require['node:fs'];
79 để cho phép ghi dữ liệu ở một số vị trí sau phần đầu của tệp, các giá trị được phép nằm trong phạm vi [0,
import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];
83]. Sửa đổi một tệp thay vì thay thế nó có thể yêu cầu tùy chọn
import * as fs from 'node:fs';const fs = require['node:fs'];
10
import * as fs from 'node:fs';const fs = require['node:fs'];
11 được đặt thành
import * as fs from 'node:fs';const fs = require['node:fs'];
12 thay vì mặc định là
import * as fs from 'node:fs';const fs = require['node:fs'];
13.
import { unlink } from 'node:fs/promises';

try {
  await unlink['/tmp/hello'];
  console.log['successfully deleted /tmp/hello'];
} catch [error] {
  console.error['there was an error:', error.message];
}const { unlink } = require['node:fs/promises'];

[async function[path] {
  try {
    await unlink[path];
    console.log[`successfully deleted ${path}`];
  } catch [error] {
    console.error['there was an error:', error.message];
  }
}]['/tmp/hello'];
87 có thể là bất kỳ một trong số đó được chấp nhận bởi

Nếu

import * as fs from 'node:fs';const fs = require['node:fs'];
02 được đặt thành true [hành vi mặc định] trên
import * as fs from 'node:fs';const fs = require['node:fs'];
04 hoặc
import * as fs from 'node:fs';const fs = require['node:fs'];
17, bộ mô tả tệp sẽ tự động bị đóng. Nếu
import * as fs from 'node:fs';const fs = require['node:fs'];
02 là sai, thì bộ mô tả tệp sẽ không bị đóng, ngay cả khi có lỗi. Ứng dụng có trách nhiệm đóng nó và đảm bảo không có rò rỉ bộ mô tả tệp

Theo mặc định, luồng sẽ phát ra sự kiện

import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
05 sau khi nó bị hủy. Đặt tùy chọn
import * as fs from 'node:fs';const fs = require['node:fs'];
00 thành
import * as fs from 'node:fs';const fs = require['node:fs'];
01 để thay đổi hành vi này

import * as fs from 'node:fs';const fs = require['node:fs'];
22
  • trả lại. Hoàn thành với
    import { open } from 'node:fs/promises';
    
    const fd = await open['sample.txt'];
    fd.createReadStream[{ start: 90, end: 99 }];
    6 khi thành công

Buộc tất cả các hoạt động I/O được xếp hàng hiện tại được liên kết với tệp về trạng thái hoàn thành I/O được đồng bộ hóa của hệ điều hành. Tham khảo tài liệu POSIX

import * as fs from 'node:fs';const fs = require['node:fs'];
24 để biết chi tiết

Không giống như

import * as fs from 'node:fs';const fs = require['node:fs'];
25, phương pháp này không xóa siêu dữ liệu đã sửa đổi

import * as fs from 'node:fs';const fs = require['node:fs'];
26
import * as fs from 'node:fs';const fs = require['node:fs'];
27
  • import * as fs from 'node:fs';const fs = require['node:fs'];
    28. . Một bộ đệm sẽ chứa đầy dữ liệu tệp đã đọc
  • import * as fs from 'node:fs';const fs = require['node:fs'];
    29 Vị trí trong bộ đệm để bắt đầu điền
  • import * as fs from 'node:fs';const fs = require['node:fs'];
    30 Số byte cần đọc
  • import * as fs from 'node:fs';const fs = require['node:fs'];
    31. Vị trí bắt đầu đọc dữ liệu từ tệp. Nếu
    import { open } from 'node:fs/promises';
    
    const fd = await open['sample.txt'];
    fd.createReadStream[{ start: 90, end: 99 }];
    5, dữ liệu sẽ được đọc từ vị trí tệp hiện tại và vị trí sẽ được cập nhật. Nếu
    import * as fs from 'node:fs';const fs = require['node:fs'];
    31 là số nguyên, vị trí tệp hiện tại sẽ không thay đổi
  • trả lại. Hoàn thành khi thành công với một đối tượng có hai thuộc tính

Đọc dữ liệu từ tệp và lưu trữ dữ liệu đó trong bộ đệm đã cho

Nếu tệp không được sửa đổi đồng thời, thì kết thúc tệp đạt được khi số byte được đọc bằng 0

import * as fs from 'node:fs';const fs = require['node:fs'];
34

Đã thêm vào. v13. 11. 0, v12. 17. 0

  • import * as fs from 'node:fs';const fs = require['node:fs'];
    78
    • import * as fs from 'node:fs';const fs = require['node:fs'];
      28. . Một bộ đệm sẽ chứa đầy dữ liệu tệp đã đọc. Mặc định.
      import * as fs from 'node:fs';const fs = require['node:fs'];
      37
    • import * as fs from 'node:fs';const fs = require['node:fs'];
      29 Vị trí trong bộ đệm để bắt đầu điền. Mặc định.
      import * as fs from 'node:fs';const fs = require['node:fs'];
      39
    • import * as fs from 'node:fs';const fs = require['node:fs'];
      30 Số byte cần đọc. Mặc định.
      import * as fs from 'node:fs';const fs = require['node:fs'];
      41
    • import * as fs from 'node:fs';const fs = require['node:fs'];
      31. Vị trí bắt đầu đọc dữ liệu từ tệp. Nếu
      import { open } from 'node:fs/promises';
      
      const fd = await open['sample.txt'];
      fd.createReadStream[{ start: 90, end: 99 }];
      5, dữ liệu sẽ được đọc từ vị trí tệp hiện tại và vị trí sẽ được cập nhật. Nếu
      import * as fs from 'node:fs';const fs = require['node:fs'];
      31 là số nguyên, vị trí tệp hiện tại sẽ không thay đổi. Mặc định.
      import { open } from 'node:fs/promises';
      
      const fd = await open['sample.txt'];
      fd.createReadStream[{ start: 90, end: 99 }];
      5
  • trả lại. Hoàn thành khi thành công với một đối tượng có hai thuộc tính
  • Đọc dữ liệu từ tệp và lưu trữ dữ liệu đó trong bộ đệm đã cho

    Nếu tệp không được sửa đổi đồng thời, thì kết thúc tệp đạt được khi số byte được đọc bằng 0

    import * as fs from 'node:fs';const fs = require['node:fs'];
    46

    Đã thêm vào. v18. 2. 0, v16. 17. 0

    • import * as fs from 'node:fs';const fs = require['node:fs'];
      28. . Một bộ đệm sẽ chứa đầy dữ liệu tệp đã đọc
    • import * as fs from 'node:fs';const fs = require['node:fs'];
      78
      • import * as fs from 'node:fs';const fs = require['node:fs'];
        29 Vị trí trong bộ đệm để bắt đầu điền. Mặc định.
        import * as fs from 'node:fs';const fs = require['node:fs'];
        39
      • import * as fs from 'node:fs';const fs = require['node:fs'];
        30 Số byte cần đọc. Mặc định.
        import * as fs from 'node:fs';const fs = require['node:fs'];
        41
      • import * as fs from 'node:fs';const fs = require['node:fs'];
        31 Vị trí bắt đầu đọc dữ liệu từ tệp. Nếu
        import { open } from 'node:fs/promises';
        
        const fd = await open['sample.txt'];
        fd.createReadStream[{ start: 90, end: 99 }];
        5, dữ liệu sẽ được đọc từ vị trí tệp hiện tại và vị trí sẽ được cập nhật. Nếu
        import * as fs from 'node:fs';const fs = require['node:fs'];
        31 là số nguyên, vị trí tệp hiện tại sẽ không thay đổi. Mặc định.
        import { open } from 'node:fs/promises';
        
        const fd = await open['sample.txt'];
        fd.createReadStream[{ start: 90, end: 99 }];
        5
    • trả lại. Hoàn thành khi thành công với một đối tượng có hai thuộc tính
    • Đọc dữ liệu từ tệp và lưu trữ dữ liệu đó trong bộ đệm đã cho

      Nếu tệp không được sửa đổi đồng thời, thì kết thúc tệp đạt được khi số byte được đọc bằng 0

      import * as fs from 'node:fs';const fs = require['node:fs'];
      57

      Trả về một

      import * as fs from 'node:fs';const fs = require['node:fs'];
      58 có thể được sử dụng để đọc dữ liệu tệp

      Sẽ xảy ra lỗi nếu phương thức này được gọi nhiều lần hoặc được gọi sau khi đóng hoặc đóng

      import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
      02

      import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
      0

      Mặc dù

      import * as fs from 'node:fs';const fs = require['node:fs'];
      58 sẽ đọc tệp cho đến khi hoàn thành, nhưng nó sẽ không tự động đóng
      import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
      02. Mã người dùng vẫn phải gọi phương thức
      import * as fs from 'node:fs';const fs = require['node:fs'];
      62

      import * as fs from 'node:fs';const fs = require['node:fs'];
      63
      • import * as fs from 'node:fs';const fs = require['node:fs'];
        78.
      • trả lại. Hoàn thành khi đọc thành công với nội dung của tệp. Nếu không chỉ định mã hóa [sử dụng
        import * as fs from 'node:fs';const fs = require['node:fs'];
        65], dữ liệu được trả về dưới dạng đối tượng. Nếu không, dữ liệu sẽ là một chuỗi
      • Đọc không đồng bộ toàn bộ nội dung của một tệp

        Nếu

        import * as fs from 'node:fs';const fs = require['node:fs'];
        78 là một chuỗi, thì nó chỉ định
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        87

        Phải hỗ trợ đọc

        Nếu một hoặc nhiều lệnh gọi

        import * as fs from 'node:fs';const fs = require['node:fs'];
        68 được thực hiện trên một bộ xử lý tệp và sau đó một lệnh gọi
        import * as fs from 'node:fs';const fs = require['node:fs'];
        69 được thực hiện, dữ liệu sẽ được đọc từ vị trí hiện tại cho đến hết tệp. Không phải lúc nào nó cũng đọc từ đầu tệp

        import * as fs from 'node:fs';const fs = require['node:fs'];
        70

        Phương pháp tiện lợi để tạo giao diện

        import * as fs from 'node:fs';const fs = require['node:fs'];
        71 và truyền phát qua tệp. Xem các tùy chọn

        import * as fs from 'node:fs';const fs = require['node:fs'];
        0
        import * as fs from 'node:fs';const fs = require['node:fs'];
        73

        Đã thêm vào. v13. 13. 0, v12. 17. 0

        • import * as fs from 'node:fs';const fs = require['node:fs'];
          74. .
        • import * as fs from 'node:fs';const fs = require['node:fs'];
          31. Phần bù từ đầu tệp nơi dữ liệu sẽ được đọc từ đó. Nếu
          import * as fs from 'node:fs';const fs = require['node:fs'];
          31 không phải là
          import * as fs from 'node:fs';const fs = require['node:fs'];
          77, dữ liệu sẽ được đọc từ vị trí hiện tại. Mặc định.
          import { open } from 'node:fs/promises';
          
          const fd = await open['sample.txt'];
          fd.createReadStream[{ start: 90, end: 99 }];
          5
        • trả lại. Hoàn thành khi thành công một đối tượng chứa hai thuộc tính

        Đọc từ một tệp và ghi vào một mảng s

        import * as fs from 'node:fs';const fs = require['node:fs'];
        79

        Lịch sửPhiên bảnThay đổiv10. 5. 0

        Chấp nhận một đối tượng

        import * as fs from 'node:fs';const fs = require['node:fs'];
        78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

        v10. 0. 0

        Đã thêm vào. v10. 0. 0

        import * as fs from 'node:fs';const fs = require['node:fs'];
        81
        • trả lại. Hoàn thành với
          import { open } from 'node:fs/promises';
          
          const fd = await open['sample.txt'];
          fd.createReadStream[{ start: 90, end: 99 }];
          6 khi thành công

        Yêu cầu tất cả dữ liệu cho bộ mô tả tệp mở được chuyển sang thiết bị lưu trữ. Việc triển khai cụ thể là hệ điều hành và thiết bị cụ thể. Tham khảo tài liệu POSIX

        import * as fs from 'node:fs';const fs = require['node:fs'];
        83 để biết thêm chi tiết

        import * as fs from 'node:fs';const fs = require['node:fs'];
        84

        Cắt bớt tập tin

        Nếu tệp lớn hơn

        import * as fs from 'node:fs';const fs = require['node:fs'];
        85 byte, thì chỉ
        import * as fs from 'node:fs';const fs = require['node:fs'];
        85 byte đầu tiên sẽ được giữ lại trong tệp

        Ví dụ sau chỉ giữ lại bốn byte đầu tiên của tệp

        import * as fs from 'node:fs';const fs = require['node:fs'];
        7

        Nếu tệp trước đó ngắn hơn

        import * as fs from 'node:fs';const fs = require['node:fs'];
        85 byte, nó sẽ được mở rộng và phần mở rộng chứa đầy byte rỗng [
        import * as fs from 'node:fs';const fs = require['node:fs'];
        88]

        Nếu

        import * as fs from 'node:fs';const fs = require['node:fs'];
        85 âm thì sẽ sử dụng
        import * as fs from 'node:fs';const fs = require['node:fs'];
        39

        import * as fs from 'node:fs';const fs = require['node:fs'];
        91

        Thay đổi dấu thời gian hệ thống tệp của đối tượng được tham chiếu sau đó giải quyết lời hứa mà không có đối số khi thành công

        import * as fs from 'node:fs';const fs = require['node:fs'];
        92

        Lịch sửPhiên bảnChangesv14. 0. 0

        Tham số

        import * as fs from 'node:fs';const fs = require['node:fs'];
        28 sẽ không ép buộc đầu vào không được hỗ trợ vào bộ đệm nữa

        v10. 0. 0

        Đã thêm vào. v10. 0. 0

        • import * as fs from 'node:fs';const fs = require['node:fs'];
          28. .
        • import * as fs from 'node:fs';const fs = require['node:fs'];
          29 Vị trí bắt đầu từ bên trong
          import * as fs from 'node:fs';const fs = require['node:fs'];
          28 nơi bắt đầu ghi dữ liệu
        • import * as fs from 'node:fs';const fs = require['node:fs'];
          30 Số lượng byte từ
          import * as fs from 'node:fs';const fs = require['node:fs'];
          28 để ghi. Mặc định.
          import * as fs from 'node:fs';const fs = require['node:fs'];
          41
        • import * as fs from 'node:fs';const fs = require['node:fs'];
          31. Phần bù từ đầu tệp nơi dữ liệu từ
          import * as fs from 'node:fs';const fs = require['node:fs'];
          28 sẽ được ghi. Nếu
          import * as fs from 'node:fs';const fs = require['node:fs'];
          31 không phải là
          import * as fs from 'node:fs';const fs = require['node:fs'];
          77, dữ liệu sẽ được ghi ở vị trí hiện tại. Xem tài liệu POSIX
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          04 để biết thêm chi tiết. Mặc định.
          import { open } from 'node:fs/promises';
          
          const fd = await open['sample.txt'];
          fd.createReadStream[{ start: 90, end: 99 }];
          5
        • trả lại.

        Viết

        import * as fs from 'node:fs';const fs = require['node:fs'];
        28 vào tệp

        Lời hứa được giải quyết với một đối tượng chứa hai thuộc tính

        Sẽ không an toàn khi sử dụng

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        07 nhiều lần trên cùng một tệp mà không đợi lời hứa được giải quyết [hoặc bị từ chối]. Đối với kịch bản này, sử dụng

        Trên Linux, chức năng ghi theo vị trí không hoạt động khi tệp được mở ở chế độ chắp thêm. Hạt nhân bỏ qua đối số vị trí và luôn nối thêm dữ liệu vào cuối tệp

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        09

        Đã thêm vào. v18. 3. 0, v16. 17. 0

        Viết

        import * as fs from 'node:fs';const fs = require['node:fs'];
        28 vào tệp

        Tương tự như hàm

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        11 ở trên, phiên bản này có một đối tượng
        import * as fs from 'node:fs';const fs = require['node:fs'];
        78 tùy chọn. Nếu không có đối tượng
        import * as fs from 'node:fs';const fs = require['node:fs'];
        78 nào được chỉ định, nó sẽ mặc định với các giá trị trên

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        14

        Lịch sửPhiên bảnChangesv14. 0. 0

        Tham số

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        15 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

        v10. 0. 0

        Đã thêm vào. v10. 0. 0

        • import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          15
        • import * as fs from 'node:fs';const fs = require['node:fs'];
          31. Phần bù từ đầu tệp nơi dữ liệu từ
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          15 sẽ được ghi. Nếu
          import * as fs from 'node:fs';const fs = require['node:fs'];
          31 không phải là
          import * as fs from 'node:fs';const fs = require['node:fs'];
          77, dữ liệu sẽ được ghi ở vị trí hiện tại. Xem tài liệu POSIX
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          04 để biết thêm chi tiết. Mặc định.
          import { open } from 'node:fs/promises';
          
          const fd = await open['sample.txt'];
          fd.createReadStream[{ start: 90, end: 99 }];
          5
        • import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 Mã hóa chuỗi dự kiến. Mặc định.
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          24
        • trả lại.

        Viết

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        15 vào tệp. Nếu
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        15 không phải là một chuỗi, thì lời hứa bị từ chối kèm theo lỗi

        Lời hứa được giải quyết với một đối tượng chứa hai thuộc tính

        • import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          27 số byte được ghi
        • import * as fs from 'node:fs';const fs = require['node:fs'];
          28 một tham chiếu đến
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          15 bằng văn bản

        Sẽ không an toàn khi sử dụng

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        07 nhiều lần trên cùng một tệp mà không đợi lời hứa được giải quyết [hoặc bị từ chối]. Đối với kịch bản này, sử dụng

        Trên Linux, chức năng ghi theo vị trí không hoạt động khi tệp được mở ở chế độ chắp thêm. Hạt nhân bỏ qua đối số vị trí và luôn nối thêm dữ liệu vào cuối tệp

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        32

        Lịch sửPhiên bảnThay đổiv15. 14. 0, v14. 18. 0

        Đối số

        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
        08 hỗ trợ
        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
        09,
        import * as fs from 'node:fs';const fs = require['node:fs'];
        00 và
        import * as fs from 'node:fs';const fs = require['node:fs'];
        01

        v14. 0. 0

        Tham số

        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
        08 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

        v10. 0. 0

        Đã thêm vào. v10. 0. 0

        Ghi dữ liệu vào tệp không đồng bộ, thay thế tệp nếu tệp đã tồn tại.

        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
        08 có thể là một chuỗi, một bộ đệm, một hoặc một đối tượng. Lời hứa được giải quyết mà không có tranh luận khi thành công

        Nếu

        import * as fs from 'node:fs';const fs = require['node:fs'];
        78 là một chuỗi, thì nó chỉ định
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        87

        Phải hỗ trợ viết

        Sẽ không an toàn khi sử dụng

        import * as fs from 'node:fs';const fs = require['node:fs'];
        03 nhiều lần trên cùng một tệp mà không đợi lời hứa được giải quyết [hoặc bị từ chối]

        Nếu một hoặc nhiều lệnh gọi

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        07 được thực hiện trên một bộ xử lý tệp và sau đó một lệnh gọi
        import * as fs from 'node:fs';const fs = require['node:fs'];
        03 được thực hiện, dữ liệu sẽ được ghi từ vị trí hiện tại cho đến hết tệp. Không phải lúc nào nó cũng ghi từ đầu tệp

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        44

        Viết một mảng s vào tệp

        Lời hứa được giải quyết với một đối tượng chứa hai thuộc tính

        Sẽ không an toàn khi gọi

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        45 nhiều lần trên cùng một tệp mà không đợi lời hứa được giải quyết [hoặc bị từ chối]

        Trên Linux, chức năng ghi theo vị trí không hoạt động khi tệp được mở ở chế độ chắp thêm. Hạt nhân bỏ qua đối số vị trí và luôn nối thêm dữ liệu vào cuối tệp

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        46

        Kiểm tra quyền của người dùng đối với tệp hoặc thư mục được chỉ định bởi

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        47. Đối số
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        48 là một số nguyên tùy chọn chỉ định kiểm tra khả năng truy cập sẽ được thực hiện.
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        48 phải là giá trị
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        50 hoặc mặt nạ bao gồm bitwise OR của bất kỳ giá trị nào trong số
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        51,
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        52 và
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        53 [e. g.
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        54]. Kiểm tra các giá trị có thể có của
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        48

        Nếu kiểm tra khả năng truy cập thành công, lời hứa sẽ được giải quyết mà không có giá trị. Nếu bất kỳ kiểm tra khả năng truy cập nào không thành công, lời hứa sẽ bị từ chối với một đối tượng. Ví dụ sau kiểm tra xem tệp

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        56 có thể được đọc và ghi bởi quy trình hiện tại không

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        8

        Không nên sử dụng

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        57 để kiểm tra khả năng truy cập tệp trước khi gọi
        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
        03. Làm như vậy sẽ đưa ra một điều kiện cạnh tranh, vì các quy trình khác có thể thay đổi trạng thái của tệp giữa hai lần gọi. Thay vào đó, mã người dùng nên trực tiếp mở/đọc/ghi tệp và xử lý lỗi phát sinh nếu tệp không thể truy cập được

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        59

        Nối dữ liệu vào một tệp không đồng bộ, tạo tệp nếu nó chưa tồn tại.

        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
        08 có thể là một chuỗi hoặc một

        Nếu

        import * as fs from 'node:fs';const fs = require['node:fs'];
        78 là một chuỗi, thì nó chỉ định
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        87

        Tùy chọn

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        48 chỉ ảnh hưởng đến tệp mới tạo. Xem để biết thêm chi tiết

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        47 có thể được chỉ định là một đã được mở để nối thêm [sử dụng
        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
        03]

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        67

        Thay đổi quyền của một tập tin

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        68

        Thay đổi quyền sở hữu của một tập tin

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        69

        Lịch sửPhiên bảnChangesv14. 0. 0

        Đã thay đổi đối số

        import * as fs from 'node:fs';const fs = require['node:fs'];
        10 thành
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        48 và áp đặt xác thực loại nghiêm ngặt hơn

        v10. 0. 0

        Đã thêm vào. v10. 0. 0

        • import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          72. . tên tệp nguồn để sao chép
        • import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          73. . tên tệp đích của thao tác sao chép
        • import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          48 Công cụ sửa đổi tùy chọn chỉ định hành vi của thao tác sao chép. Có thể tạo một mặt nạ bao gồm OR theo bit của hai hoặc nhiều giá trị [e. g.
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          75] Mặc định.
          import * as fs from 'node:fs';const fs = require['node:fs'];
          39
          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            77. Thao tác sao chép sẽ thất bại nếu
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            73 đã tồn tại
          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            79. Thao tác sao chép sẽ cố gắng tạo liên kết giới thiệu sao chép khi ghi. Nếu nền tảng không hỗ trợ sao chép khi ghi, thì cơ chế sao chép dự phòng sẽ được sử dụng
          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            80. Thao tác sao chép sẽ cố gắng tạo liên kết giới thiệu sao chép khi ghi. Nếu nền tảng không hỗ trợ sao chép khi ghi, thì thao tác sẽ không thành công
        • trả lại. Hoàn thành với
          import { open } from 'node:fs/promises';
          
          const fd = await open['sample.txt'];
          fd.createReadStream[{ start: 90, end: 99 }];
          6 khi thành công

        Sao chép không đồng bộ

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        72 sang
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        73. Theo mặc định,
        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        73 được ghi đè nếu nó đã tồn tại

        Không có đảm bảo nào về tính nguyên tử của hoạt động sao chép. Nếu xảy ra lỗi sau khi tệp đích đã được mở để ghi, một nỗ lực sẽ được thực hiện để xóa đích

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        85

        Lịch sửPhiên bảnThay đổiv17. 6. 0, v16. 15. 0

        Chấp nhận tùy chọn

        import { unlink } from 'node:fs/promises';
        
        try {
          await unlink['/tmp/hello'];
          console.log['successfully deleted /tmp/hello'];
        } catch [error] {
          console.error['there was an error:', error.message];
        }const { unlink } = require['node:fs/promises'];
        
        [async function[path] {
          try {
            await unlink[path];
            console.log[`successfully deleted ${path}`];
          } catch [error] {
            console.error['there was an error:', error.message];
          }
        }]['/tmp/hello'];
        86 bổ sung để chỉ định có thực hiện phân giải đường dẫn cho liên kết tượng trưng hay không

        v16. 7. 0

        Đã thêm vào. v16. 7. 0

        • import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          72. đường dẫn nguồn để sao chép
        • import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          73. đường dẫn đích để sao chép vào
        • import * as fs from 'node:fs';const fs = require['node:fs'];
          78
          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            90 liên kết tượng trưng dereference. Mặc định.
            import * as fs from 'node:fs';const fs = require['node:fs'];
            01
          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            92 khi
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            93 là
            import * as fs from 'node:fs';const fs = require['node:fs'];
            01 và đích tồn tại, đưa ra lỗi. Mặc định.
            import * as fs from 'node:fs';const fs = require['node:fs'];
            01
          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            96 Chức năng lọc tập tin/thư mục sao chép. Trả lại
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            97 để sao chép mục này,
            import * as fs from 'node:fs';const fs = require['node:fs'];
            01 để bỏ qua nó. Cũng có thể trả về một
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            99 phân giải thành
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            97 hoặc
            import * as fs from 'node:fs';const fs = require['node:fs'];
            01 Mặc định.
            import { open } from 'node:fs/promises';
            
            const fd = await open['sample.txt'];
            fd.createReadStream[{ start: 90, end: 99 }];
            6
          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            93 ghi đè lên tệp hoặc thư mục hiện có. Thao tác sao chép sẽ bỏ qua lỗi nếu bạn đặt giá trị này thành false và đích tồn tại. Sử dụng tùy chọn
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            92 để thay đổi hành vi này. Mặc định.
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            97
          • import { unlink } from 'node:fs';
            
            unlink['/tmp/hello', [err] => {
              if [err] throw err;
              console.log['successfully deleted /tmp/hello'];
            }];const { unlink } = require['node:fs'];
            
            unlink['/tmp/hello', [err] => {
              if [err] throw err;
              console.log['successfully deleted /tmp/hello'];
            }];
            06 Khi dấu thời gian của
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            97 từ
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            72 sẽ được giữ nguyên. Mặc định.
            import * as fs from 'node:fs';const fs = require['node:fs'];
            01
          • import { unlink } from 'node:fs';
            
            unlink['/tmp/hello', [err] => {
              if [err] throw err;
              console.log['successfully deleted /tmp/hello'];
            }];const { unlink } = require['node:fs'];
            
            unlink['/tmp/hello', [err] => {
              if [err] throw err;
              console.log['successfully deleted /tmp/hello'];
            }];
            10 sao chép thư mục theo cách đệ quy Mặc định.
            import * as fs from 'node:fs';const fs = require['node:fs'];
            01
          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            86 Khi
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            97, độ phân giải đường dẫn cho các liên kết tượng trưng sẽ bị bỏ qua. Mặc định.
            import * as fs from 'node:fs';const fs = require['node:fs'];
            01
        • trả lại. Hoàn thành với
          import { open } from 'node:fs/promises';
          
          const fd = await open['sample.txt'];
          fd.createReadStream[{ start: 90, end: 99 }];
          6 khi thành công
        • Sao chép không đồng bộ toàn bộ cấu trúc thư mục từ

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          72 đến
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          73, bao gồm các thư mục con và tệp

          Khi sao chép một thư mục sang một thư mục khác, khối cầu không được hỗ trợ và hành vi tương tự như

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          18

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          19

          Không dùng nữa kể từ. v10. 0. 0

          Thay đổi quyền trên một liên kết tượng trưng

          Phương pháp này chỉ được thực hiện trên macOS

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          20

          Lịch sửPhiên bảnChangesv10. 6. 0

          API này không còn được dùng nữa

          v10. 0. 0

          Đã thêm vào. v10. 0. 0

          Thay đổi quyền sở hữu trên một liên kết tượng trưng

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          21

          Đã thêm vào. v14. 5. 0, v12. 19. 0

          Thay đổi thời gian truy cập và sửa đổi của một tệp giống như cách thay đổi, với điểm khác biệt là nếu đường dẫn đề cập đến một liên kết tượng trưng, ​​thì liên kết đó không được hủy đăng ký. thay vào đó, dấu thời gian của chính liên kết tượng trưng được thay đổi

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          23

          Tạo một liên kết mới từ ________ 624 đến ________ 625. Xem tài liệu POSIX

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          26 để biết thêm chi tiết

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          27

          Lịch sửPhiên bảnThay đổiv10. 5. 0

          Chấp nhận một đối tượng

          import * as fs from 'node:fs';const fs = require['node:fs'];
          78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

          v10. 0. 0

          Đã thêm vào. v10. 0. 0

          Tương đương với trừ khi

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          47 đề cập đến một liên kết tượng trưng, ​​trong trường hợp đó, chính liên kết đó đã được thống kê, không phải tệp mà nó đề cập đến. Tham khảo tài liệu POSIX
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          31 để biết thêm chi tiết

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          32

          Tạo thư mục không đồng bộ

          Đối số

          import * as fs from 'node:fs';const fs = require['node:fs'];
          78 tùy chọn có thể là một số nguyên chỉ định
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          48 [các bit quyền và dính] hoặc một đối tượng có thuộc tính
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          48 và thuộc tính
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          10 cho biết có nên tạo thư mục mẹ hay không. Gọi
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          37 khi
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          47 là một thư mục tồn tại dẫn đến từ chối chỉ khi
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          10 là sai

          import * as fs from 'node:fs';const fs = require['node:fs'];
          0

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          40

          Lịch sửPhiên bảnThay đổiv16. 5. 0, v14. 18. 0

          Tham số

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          41 hiện chấp nhận một chuỗi rỗng

          v10. 0. 0

          Đã thêm vào. v10. 0. 0

          Tạo một thư mục tạm thời duy nhất. Một tên thư mục duy nhất được tạo bằng cách thêm sáu ký tự ngẫu nhiên vào cuối

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          41 được cung cấp. Do sự không nhất quán của nền tảng, hãy tránh sử dụng các ký tự
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          43 trong
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          41. Một số nền tảng, đặc biệt là BSD, có thể trả về nhiều hơn sáu ký tự ngẫu nhiên và thay thế các ký tự
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          43 ở cuối trong
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          41 bằng các ký tự ngẫu nhiên

          Đối số

          import * as fs from 'node:fs';const fs = require['node:fs'];
          78 tùy chọn có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 chỉ định mã hóa ký tự sẽ sử dụng

          import * as fs from 'node:fs';const fs = require['node:fs'];
          1

          Phương thức

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          49 sẽ nối trực tiếp sáu ký tự được chọn ngẫu nhiên vào chuỗi
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          41. Ví dụ: được cung cấp một thư mục
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          51, nếu mục đích là tạo một thư mục tạm thời trong
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          51, thì ____641 phải kết thúc bằng dấu phân cách đường dẫn dành riêng cho nền tảng [
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          54]

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          55

          Lịch sửPhiên bảnChangesv11. 1. 0

          Đối số

          import * as fs from 'node:fs';const fs = require['node:fs'];
          10 hiện là tùy chọn và mặc định là
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          57

          v10. 0. 0

          Đã thêm vào. v10. 0. 0

          mở một

          Tham khảo tài liệu POSIX

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          58 để biết thêm chi tiết

          Một số ký tự [

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          59] được dành riêng trong Windows như được ghi lại bằng cách đặt tên tệp, đường dẫn và không gian tên. Trong NTFS, nếu tên tệp chứa dấu hai chấm, Nút. js sẽ mở một luồng hệ thống tệp, như được mô tả bởi this MSDN page

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          60

          Lịch sửPhiên bảnThay đổiv13. 1. 0, v12. 16. 0

          Tùy chọn

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          61 đã được giới thiệu

          v12. 12. 0

          Đã thêm vào. v12. 12. 0

          Mở thư mục không đồng bộ để quét lặp lại. Xem tài liệu POSIX

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          62 để biết thêm chi tiết

          Tạo một , chứa tất cả các chức năng khác để đọc và dọn dẹp thư mục

          Tùy chọn

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 đặt mã hóa cho
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          47 trong khi mở thư mục và các thao tác đọc tiếp theo

          Ví dụ sử dụng phép lặp không đồng bộ

          import * as fs from 'node:fs';const fs = require['node:fs'];
          2

          Khi sử dụng async iterator, đối tượng sẽ tự động đóng sau khi iterator thoát

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          65

          Lịch sửPhiên bảnThay đổiv10. 11. 0

          Tùy chọn mới

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          66 đã được thêm vào

          v10. 0. 0

          Đã thêm vào. v10. 0. 0

          Đọc nội dung của một thư mục

          Đối số tùy chọn

          import * as fs from 'node:fs';const fs = require['node:fs'];
          78 có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 chỉ định mã hóa ký tự sẽ sử dụng cho tên tệp. Nếu
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 được đặt thành
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          70, tên tệp được trả về sẽ được chuyển dưới dạng đối tượng

          Nếu

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          71 được đặt thành
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          97, mảng đã phân giải sẽ chứa các đối tượng

          import * as fs from 'node:fs';const fs = require['node:fs'];
          3

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          73

          Lịch sửPhiên bảnThay đổiv15. 2. 0, v14. 17. 0

          Đối số tùy chọn có thể bao gồm AbortSignal để hủy bỏ yêu cầu readFile đang diễn ra

          v10. 0. 0

          Đã thêm vào. v10. 0. 0

          Đọc không đồng bộ toàn bộ nội dung của một tệp

          Nếu không chỉ định mã hóa [sử dụng

          import * as fs from 'node:fs';const fs = require['node:fs'];
          65], dữ liệu được trả về dưới dạng đối tượng. Nếu không, dữ liệu sẽ là một chuỗi

          Nếu

          import * as fs from 'node:fs';const fs = require['node:fs'];
          78 là một chuỗi, thì nó chỉ định mã hóa

          Khi

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          47 là một thư mục, hành vi của
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          77 là dành riêng cho nền tảng. Trên macOS, Linux và Windows, lời hứa sẽ bị từ chối do lỗi. Trên FreeBSD, nội dung của thư mục sẽ được trả về

          Một ví dụ về đọc tệp

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          78 nằm trong cùng thư mục của mã đang chạy

          import * as fs from 'node:fs';const fs = require['node:fs'];
          4

          Có thể hủy bỏ một

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          79 đang diễn ra bằng cách sử dụng một. Nếu một yêu cầu bị hủy bỏ, lời hứa được trả lại sẽ bị từ chối với một
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          80

          Việc hủy bỏ một yêu cầu đang diễn ra không hủy bỏ các yêu cầu riêng lẻ của hệ điều hành mà thay vào đó, bộ đệm nội bộ

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          81 thực hiện

          Bất kỳ quy định nào phải hỗ trợ đọc

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          82

          Đọc nội dung của liên kết tượng trưng được gọi bởi

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          47. Xem tài liệu POSIX
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          84 để biết thêm chi tiết. Lời hứa được giải quyết với
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          85 khi thành công

          Đối số tùy chọn

          import * as fs from 'node:fs';const fs = require['node:fs'];
          78 có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 chỉ định mã hóa ký tự sẽ sử dụng cho đường dẫn liên kết được trả về. Nếu
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 được đặt thành
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          70, đường dẫn liên kết được trả về sẽ được chuyển dưới dạng đối tượng

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          90

          Xác định vị trí thực tế của

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          47 bằng cách sử dụng ngữ nghĩa tương tự như hàm
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          92

          Chỉ hỗ trợ các đường dẫn có thể chuyển đổi thành chuỗi UTF8

          Đối số tùy chọn

          import * as fs from 'node:fs';const fs = require['node:fs'];
          78 có thể là một chuỗi chỉ định mã hóa hoặc một đối tượng có thuộc tính
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 chỉ định mã hóa ký tự sẽ sử dụng cho đường dẫn. Nếu
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          87 được đặt thành
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          70, đường dẫn được trả về sẽ được truyền dưới dạng đối tượng

          Trên Linux, khi nút. js được liên kết với musl libc, hệ thống tệp procfs phải được gắn trên

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          97 để chức năng này hoạt động. Glibc không có hạn chế này

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          98

          Đổi tên

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          99 thành
          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          25

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          201

          Lịch sửPhiên bảnThay đổiv16. 0. 0

          Sử dụng

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          202 trên một tệp
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          47 không còn được phép và dẫn đến lỗi
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          204 trên Windows và lỗi
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          205 trên POSIX

          v16. 0. 0

          Việc sử dụng

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          202 trên một
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          47 không tồn tại sẽ không còn được phép và dẫn đến lỗi
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          204

          v16. 0. 0

          Tùy chọn

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          10 không được dùng nữa, sử dụng tùy chọn này sẽ kích hoạt cảnh báo không dùng nữa

          v14. 14. 0

          Tùy chọn

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          10 không được dùng nữa, thay vào đó hãy sử dụng
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          211

          v13. 3. 0, v12. 16. 0

          Tùy chọn

          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          212 được đổi tên thành
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          213 và giá trị mặc định là 0. Tùy chọn
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          214 đã bị xóa và các lỗi
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          215 sử dụng logic thử lại giống như các lỗi khác. Tùy chọn
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          216 hiện được hỗ trợ. Lỗi
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          217 hiện đã được thử lại

          v12. 10. 0

          Các tùy chọn

          import { unlink } from 'node:fs';
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];const { unlink } = require['node:fs'];
          
          unlink['/tmp/hello', [err] => {
            if [err] throw err;
            console.log['successfully deleted /tmp/hello'];
          }];
          10,
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          212 và
          import { unlink } from 'node:fs/promises';
          
          try {
            await unlink['/tmp/hello'];
            console.log['successfully deleted /tmp/hello'];
          } catch [error] {
            console.error['there was an error:', error.message];
          }const { unlink } = require['node:fs/promises'];
          
          [async function[path] {
            try {
              await unlink[path];
              console.log[`successfully deleted ${path}`];
            } catch [error] {
              console.error['there was an error:', error.message];
            }
          }]['/tmp/hello'];
          214 hiện đã được hỗ trợ

          v10. 0. 0

          Đã thêm vào. v10. 0. 0

          • import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            47. .
          • import * as fs from 'node:fs';const fs = require['node:fs'];
            78
            • import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              213 Nếu gặp lỗi
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              224,
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              215,
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              217,
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              227 hoặc
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              228, Nút. js thử lại thao tác với thời gian chờ dự phòng tuyến tính dài hơn
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              216 mili giây cho mỗi lần thử. Tùy chọn này đại diện cho số lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
              import { unlink } from 'node:fs';
              
              unlink['/tmp/hello', [err] => {
                if [err] throw err;
                console.log['successfully deleted /tmp/hello'];
              }];const { unlink } = require['node:fs'];
              
              unlink['/tmp/hello', [err] => {
                if [err] throw err;
                console.log['successfully deleted /tmp/hello'];
              }];
              10 không phải là
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              97. Mặc định.
              import * as fs from 'node:fs';const fs = require['node:fs'];
              39
            • import { unlink } from 'node:fs';
              
              unlink['/tmp/hello', [err] => {
                if [err] throw err;
                console.log['successfully deleted /tmp/hello'];
              }];const { unlink } = require['node:fs'];
              
              unlink['/tmp/hello', [err] => {
                if [err] throw err;
                console.log['successfully deleted /tmp/hello'];
              }];
              10 Nếu
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              97, thực hiện xóa thư mục đệ quy. Trong chế độ đệ quy, các hoạt động được thử lại khi thất bại. Mặc định.
              import * as fs from 'node:fs';const fs = require['node:fs'];
              01. không dùng nữa
            • import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              216 Lượng thời gian tính bằng mili giây để chờ giữa các lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
              import { unlink } from 'node:fs';
              
              unlink['/tmp/hello', [err] => {
                if [err] throw err;
                console.log['successfully deleted /tmp/hello'];
              }];const { unlink } = require['node:fs'];
              
              unlink['/tmp/hello', [err] => {
                if [err] throw err;
                console.log['successfully deleted /tmp/hello'];
              }];
              10 không phải là
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              97. Mặc định.
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              239
          • trả lại. Hoàn thành với
            import { open } from 'node:fs/promises';
            
            const fd = await open['sample.txt'];
            fd.createReadStream[{ start: 90, end: 99 }];
            6 khi thành công
          • Xóa thư mục được xác định bởi

            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            47

            Sử dụng

            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            242 trên tệp [không phải thư mục] dẫn đến lời hứa bị từ chối với lỗi
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            204 trên Windows và lỗi
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            205 trên POSIX

            Để có hành vi tương tự như lệnh

            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            245 Unix, hãy sử dụng với các tùy chọn
            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            247

            import { unlink } from 'node:fs/promises';
            
            try {
              await unlink['/tmp/hello'];
              console.log['successfully deleted /tmp/hello'];
            } catch [error] {
              console.error['there was an error:', error.message];
            }const { unlink } = require['node:fs/promises'];
            
            [async function[path] {
              try {
                await unlink[path];
                console.log[`successfully deleted ${path}`];
              } catch [error] {
                console.error['there was an error:', error.message];
              }
            }]['/tmp/hello'];
            248

            • import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              47. .
            • import * as fs from 'node:fs';const fs = require['node:fs'];
              78
              • import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                93 Khi
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                97, các ngoại lệ sẽ bị bỏ qua nếu
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                47 không tồn tại. Mặc định.
                import * as fs from 'node:fs';const fs = require['node:fs'];
                01
              • import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                213 Nếu gặp lỗi
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                224,
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                215,
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                217,
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                227 hoặc
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                228, Nút. js sẽ thử lại thao tác với thời gian chờ tắt tuyến tính dài hơn
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                216 mili giây cho mỗi lần thử. Tùy chọn này đại diện cho số lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                import { unlink } from 'node:fs';
                
                unlink['/tmp/hello', [err] => {
                  if [err] throw err;
                  console.log['successfully deleted /tmp/hello'];
                }];const { unlink } = require['node:fs'];
                
                unlink['/tmp/hello', [err] => {
                  if [err] throw err;
                  console.log['successfully deleted /tmp/hello'];
                }];
                10 không phải là
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                97. Mặc định.
                import * as fs from 'node:fs';const fs = require['node:fs'];
                39
              • import { unlink } from 'node:fs';
                
                unlink['/tmp/hello', [err] => {
                  if [err] throw err;
                  console.log['successfully deleted /tmp/hello'];
                }];const { unlink } = require['node:fs'];
                
                unlink['/tmp/hello', [err] => {
                  if [err] throw err;
                  console.log['successfully deleted /tmp/hello'];
                }];
                10 Nếu
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                97, thực hiện xóa thư mục đệ quy. Trong chế độ đệ quy, các hoạt động được thử lại khi thất bại. Mặc định.
                import * as fs from 'node:fs';const fs = require['node:fs'];
                01
              • import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                216 Lượng thời gian tính bằng mili giây để chờ giữa các lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                import { unlink } from 'node:fs';
                
                unlink['/tmp/hello', [err] => {
                  if [err] throw err;
                  console.log['successfully deleted /tmp/hello'];
                }];const { unlink } = require['node:fs'];
                
                unlink['/tmp/hello', [err] => {
                  if [err] throw err;
                  console.log['successfully deleted /tmp/hello'];
                }];
                10 không phải là
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                97. Mặc định.
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                239
            • trả lại. Hoàn thành với
              import { open } from 'node:fs/promises';
              
              const fd = await open['sample.txt'];
              fd.createReadStream[{ start: 90, end: 99 }];
              6 khi thành công
            • Xóa các tệp và thư mục [được mô hình hóa trên tiện ích POSIX

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              273 tiêu chuẩn]

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              274

              Lịch sửPhiên bảnThay đổiv10. 5. 0

              Chấp nhận một đối tượng

              import * as fs from 'node:fs';const fs = require['node:fs'];
              78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

              v10. 0. 0

              Đã thêm vào. v10. 0. 0

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              276

              Lịch sửPhiên bảnThay đổiv19. 0. 0

              Nếu đối số

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              277 là
              import { open } from 'node:fs/promises';
              
              const fd = await open['sample.txt'];
              fd.createReadStream[{ start: 90, end: 99 }];
              5 hoặc bị bỏ qua, Nút. js sẽ tự động phát hiện loại
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              279 và tự động chọn
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              280 hoặc
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              281

              v10. 0. 0

              Đã thêm vào. v10. 0. 0

              Tạo một liên kết tượng trưng

              Đối số

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              277 chỉ được sử dụng trên nền tảng Windows và có thể là một trong số
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              283,
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              284 hoặc
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              285. Nếu đối số
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              277 không phải là một chuỗi, Nút. js sẽ tự động phát hiện loại
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              279 và sử dụng
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              284 hoặc
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              283. Nếu
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              279 không tồn tại,
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              284 sẽ được sử dụng. Các điểm giao nhau của Windows yêu cầu đường dẫn đích phải tuyệt đối. Khi sử dụng
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              285, đối số
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              279 sẽ tự động được chuẩn hóa thành đường dẫn tuyệt đối

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              294

              Cắt bớt [rút ngắn hoặc kéo dài độ dài] của nội dung ở

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              47 thành
              import * as fs from 'node:fs';const fs = require['node:fs'];
              85 byte

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              297

              Nếu

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              47 đề cập đến một liên kết tượng trưng, ​​thì liên kết đó sẽ bị xóa mà không ảnh hưởng đến tệp hoặc thư mục mà liên kết đó đề cập đến. Nếu
              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              47 đề cập đến đường dẫn tệp không phải là liên kết tượng trưng, ​​tệp sẽ bị xóa. Xem tài liệu POSIX
              import { open } from 'node:fs/promises';
              
              const fd = await open['sample.txt'];
              fd.createReadStream[{ start: 90, end: 99 }];
              00 để biết thêm chi tiết

              import { open } from 'node:fs/promises';
              
              const fd = await open['sample.txt'];
              fd.createReadStream[{ start: 90, end: 99 }];
              01

              Thay đổi dấu thời gian hệ thống tệp của đối tượng được tham chiếu bởi

              import { unlink } from 'node:fs/promises';
              
              try {
                await unlink['/tmp/hello'];
                console.log['successfully deleted /tmp/hello'];
              } catch [error] {
                console.error['there was an error:', error.message];
              }const { unlink } = require['node:fs/promises'];
              
              [async function[path] {
                try {
                  await unlink[path];
                  console.log[`successfully deleted ${path}`];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }
              }]['/tmp/hello'];
              47

              Các đối số

              import { open } from 'node:fs/promises';
              
              const fd = await open['sample.txt'];
              fd.createReadStream[{ start: 90, end: 99 }];
              03 và
              import { open } from 'node:fs/promises';
              
              const fd = await open['sample.txt'];
              fd.createReadStream[{ start: 90, end: 99 }];
              04 tuân theo các quy tắc này

              • Các giá trị có thể là các số đại diện cho thời gian Unix epoch,
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                05s hoặc một chuỗi số như
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                06
              • Nếu giá trị không thể được chuyển đổi thành một số hoặc là
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                07,
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                08 hoặc
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                09, một
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                10 sẽ bị ném

              import { open } from 'node:fs/promises';
              
              const fd = await open['sample.txt'];
              fd.createReadStream[{ start: 90, end: 99 }];
              11

              Đã thêm vào. v15. 9. 0, v14. 18. 0

              • import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                12. .
              • import * as fs from 'node:fs';const fs = require['node:fs'];
                78.
                • import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  14 Cho biết liệu quy trình có nên tiếp tục chạy miễn là các tệp đang được xem hay không. Mặc định.
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  97
                • import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10 Cho biết nên xem tất cả các thư mục con hay chỉ thư mục hiện tại. Điều này áp dụng khi một thư mục được chỉ định và chỉ trên các nền tảng được hỗ trợ [Xem ]. Mặc định.
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  01
                • import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 Chỉ định mã hóa ký tự được sử dụng cho tên tệp được chuyển đến trình nghe. Mặc định.
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  24
                • import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  20 Dùng để báo hiệu khi người quan sát nên dừng lại
              • trả lại. của các đối tượng với các thuộc tính
              • Trả về một trình vòng lặp không đồng bộ theo dõi các thay đổi trên

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                12, trong đó
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                12 là một tệp hoặc một thư mục

                import * as fs from 'node:fs';const fs = require['node:fs'];
                5

                Trên hầu hết các nền tảng,

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                23 được phát ra bất cứ khi nào tên tệp xuất hiện hoặc biến mất trong thư mục

                Tất cả các cho

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                24 cũng áp dụng cho
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                25

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                26

                Lịch sửPhiên bảnThay đổiv15. 14. 0, v14. 18. 0

                Đối số

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                08 hỗ trợ
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                09,
                import * as fs from 'node:fs';const fs = require['node:fs'];
                00 và
                import * as fs from 'node:fs';const fs = require['node:fs'];
                01

                v15. 2. 0, v14. 17. 0

                Đối số tùy chọn có thể bao gồm AbortSignal để hủy bỏ yêu cầu writeFile đang diễn ra

                v14. 0. 0

                Tham số

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                08 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

                v10. 0. 0

                Đã thêm vào. v10. 0. 0

                Ghi dữ liệu vào tệp không đồng bộ, thay thế tệp nếu tệp đã tồn tại.

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                08 có thể là một chuỗi, một bộ đệm, một hoặc một đối tượng

                Tùy chọn

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                87 bị bỏ qua nếu
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                08 là bộ đệm

                Nếu

                import * as fs from 'node:fs';const fs = require['node:fs'];
                78 là một chuỗi, thì nó chỉ định mã hóa

                Tùy chọn

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48 chỉ ảnh hưởng đến tệp mới tạo. Xem để biết thêm chi tiết

                Bất kỳ quy định nào phải hỗ trợ viết

                Sẽ không an toàn khi sử dụng

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                38 nhiều lần trên cùng một tệp mà không đợi lời hứa được giải quyết

                Tương tự như

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                39 -
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                40 là một phương thức tiện lợi thực hiện nhiều cuộc gọi
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                41 bên trong để ghi bộ đệm được truyền cho nó. Đối với mã nhạy cảm về hiệu suất, hãy cân nhắc sử dụng hoặc

                Có thể sử dụng an để hủy một

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                38. Việc hủy bỏ là "nỗ lực tốt nhất" và một số lượng dữ liệu có thể vẫn được ghi

                Việc hủy bỏ một yêu cầu đang diễn ra không hủy bỏ các yêu cầu riêng lẻ của hệ điều hành mà thay vào đó, bộ đệm nội bộ

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                45 thực hiện

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                46

                Đã thêm vào. v18. 4. 0, v16. 17. 0

                Trả về một đối tượng chứa các hằng số thường được sử dụng cho các hoạt động của hệ thống tệp. Đối tượng giống như

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                47. Xem để biết thêm chi tiết

                API gọi lại

                API gọi lại thực hiện tất cả các hoạt động không đồng bộ, không chặn vòng lặp sự kiện, sau đó gọi hàm gọi lại khi hoàn thành hoặc gặp lỗi

                API gọi lại sử dụng Nút bên dưới. js để thực hiện các hoạt động của hệ thống tệp ngoài luồng vòng lặp sự kiện. Các hoạt động này không được đồng bộ hóa hoặc luồng an toàn. Phải cẩn thận khi thực hiện nhiều sửa đổi đồng thời trên cùng một tệp, nếu không có thể xảy ra lỗi dữ liệu

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                48

                Lịch sửPhiên bảnThay đổiv18. 0. 0

                Chuyển một cuộc gọi lại không hợp lệ cho đối số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 giờ sẽ ném
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                50 thay vì
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                51

                v7. 6. 0

                Tham số

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                47 có thể là một đối tượng WHATWG
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                53 sử dụng giao thức
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                54

                v6. 3. 0

                Các hằng số như

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                55, v.v. có mặt trực tiếp trên
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                56 đã được chuyển vào
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                47 dưới dạng phản đối mềm. Do đó đối với nút. js
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                58 sử dụng
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                56 để truy cập các hằng số đó hoặc làm điều gì đó như
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                60 để hoạt động với tất cả các phiên bản

                v0. 11. 15

                Đã thêm vào. v0. 11. 15

                Kiểm tra quyền của người dùng đối với tệp hoặc thư mục được chỉ định bởi

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                47. Đối số
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48 là một số nguyên tùy chọn chỉ định kiểm tra khả năng truy cập sẽ được thực hiện.
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48 phải là giá trị
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                50 hoặc mặt nạ bao gồm bitwise OR của bất kỳ giá trị nào trong số
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                51,
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                52 và
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                53 [e. g.
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                54]. Kiểm tra các giá trị có thể có của
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48

                Đối số cuối cùng,

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49, là một hàm gọi lại được gọi với một đối số lỗi có thể xảy ra. Nếu bất kỳ kiểm tra khả năng truy cập nào không thành công, đối số lỗi sẽ là một đối tượng
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                10. Các ví dụ sau kiểm tra xem
                import { unlink } from 'node:fs';
                
                unlink['/tmp/hello', [err] => {
                  if [err] throw err;
                  console.log['successfully deleted /tmp/hello'];
                }];const { unlink } = require['node:fs'];
                
                unlink['/tmp/hello', [err] => {
                  if [err] throw err;
                  console.log['successfully deleted /tmp/hello'];
                }];
                78 có tồn tại không và liệu nó có thể đọc hoặc ghi được không

                Không sử dụng

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                73 để kiểm tra khả năng truy cập tệp trước khi gọi
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                64,
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                75 hoặc
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                76. Làm như vậy sẽ đưa ra một điều kiện cạnh tranh, vì các quy trình khác có thể thay đổi trạng thái của tệp giữa hai lần gọi. Thay vào đó, mã người dùng nên trực tiếp mở/đọc/ghi tệp và xử lý lỗi phát sinh nếu tệp không thể truy cập được

                viết [KHÔNG ĐƯỢC KHUYẾN NGHỊ]

                import * as fs from 'node:fs';const fs = require['node:fs'];
                6

                viết [KHUYẾN NGHỊ]

                import * as fs from 'node:fs';const fs = require['node:fs'];
                7

                đọc [KHÔNG ĐƯỢC KHUYẾN NGHỊ]

                import * as fs from 'node:fs';const fs = require['node:fs'];
                8

                đọc [KHUYẾN NGHỊ]

                import * as fs from 'node:fs';const fs = require['node:fs'];
                9

                Các ví dụ "không được đề xuất" ở trên kiểm tra khả năng truy cập rồi sử dụng tệp;

                Nói chung, chỉ kiểm tra khả năng truy cập của tệp nếu tệp đó sẽ không được sử dụng trực tiếp, ví dụ khi khả năng truy cập tệp là tín hiệu từ một quy trình khác

                Trên Windows, các chính sách kiểm soát truy cập [ACL] trên một thư mục có thể giới hạn quyền truy cập vào một tệp hoặc thư mục. Tuy nhiên, hàm

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                73 không kiểm tra ACL và do đó có thể báo cáo rằng một đường dẫn có thể truy cập được ngay cả khi ACL hạn chế người dùng đọc hoặc ghi vào nó

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                78

                Lịch sửPhiên bảnThay đổiv18. 0. 0

                Chuyển một cuộc gọi lại không hợp lệ cho đối số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 giờ sẽ ném
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                50 thay vì
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                51

                v10. 0. 0

                Tham số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                83 khi chạy

                v7. 0. 0

                Tham số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                v7. 0. 0

                Đối tượng

                import * as fs from 'node:fs';const fs = require['node:fs'];
                78 đã qua sẽ không bao giờ được sửa đổi

                v5. 0. 0

                Tham số

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                281 hiện có thể là một bộ mô tả tệp

                v0. 6. 7

                Đã thêm vào. v0. 6. 7

                Nối dữ liệu vào một tệp không đồng bộ, tạo tệp nếu nó chưa tồn tại.

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                08 có thể là một chuỗi hoặc một

                Tùy chọn

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48 chỉ ảnh hưởng đến tệp mới tạo. Xem để biết thêm chi tiết

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                0

                Nếu

                import * as fs from 'node:fs';const fs = require['node:fs'];
                78 là một chuỗi, thì nó chỉ định mã hóa

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                1

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                47 có thể được chỉ định làm bộ mô tả tệp số đã được mở để nối thêm [sử dụng
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                64 hoặc
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                93]. Bộ mô tả tệp sẽ không được đóng tự động

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                2

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                94

                Lịch sửPhiên bảnThay đổiv18. 0. 0

                Chuyển một cuộc gọi lại không hợp lệ cho đối số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 giờ sẽ ném
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                50 thay vì
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                51

                v10. 0. 0

                Tham số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                83 khi chạy

                v7. 6. 0

                Tham số

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                47 có thể là một đối tượng WHATWG
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                53 sử dụng giao thức
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                54

                v7. 0. 0

                Tham số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                v0. 1. 30

                Đã thêm vào. v0. 1. 30

                Thay đổi không đồng bộ các quyền của tệp. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                Xem tài liệu POSIX

                import * as fs from 'node:fs';const fs = require['node:fs'];
                07 để biết thêm chi tiết

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                3chế độ tập tin

                Đối số

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48 được sử dụng trong cả hai phương pháp
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                006 và
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                007 là một bitmask số được tạo bằng cách sử dụng OR logic của các hằng số sau

                Constantoctaldescrip mô tả

                Một phương pháp dễ dàng hơn để xây dựng

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48 là sử dụng một dãy gồm ba chữ số bát phân [e. g.
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                027]. Chữ số ngoài cùng bên trái [
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                028 trong ví dụ], chỉ định quyền cho chủ sở hữu tệp. Chữ số ở giữa [
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                029 trong ví dụ], chỉ định quyền cho nhóm. Chữ số ngoài cùng bên phải [____1030 trong ví dụ], chỉ định quyền cho những người khác

                Số Mô tả
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                028đọc, viết và thực hiện
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                029đọc và viết
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                030chỉ đọc và thực hiện
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                034chỉ đọc
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                035viết và thực hiện
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                036chỉ viết
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                037chỉ thực hiện
                import * as fs from 'node:fs';const fs = require['node:fs'];
                39không có quyền

                Ví dụ: giá trị bát phân

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                039 có nghĩa là

                • Chủ sở hữu có thể đọc, ghi và thực thi tệp
                • Nhóm có thể đọc và ghi tệp
                • Những người khác có thể đọc và thực thi tệp

                Khi sử dụng các số nguyên trong đó các chế độ tệp được mong đợi, bất kỳ giá trị nào lớn hơn

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                040 đều có thể dẫn đến các hành vi dành riêng cho nền tảng không được hỗ trợ để hoạt động nhất quán. Do đó, các hằng số như
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                041,
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                042 hoặc
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                043 không được hiển thị trong
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                47

                Hãy cẩn thận. trên Windows chỉ có thể thay đổi quyền ghi và sự khác biệt giữa các quyền của nhóm, chủ sở hữu hoặc những người khác không được triển khai

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                045

                Lịch sửPhiên bảnThay đổiv18. 0. 0

                Chuyển một cuộc gọi lại không hợp lệ cho đối số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 giờ sẽ ném
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                50 thay vì
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                51

                v10. 0. 0

                Tham số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                83 khi chạy

                v7. 6. 0

                Tham số

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                47 có thể là một đối tượng WHATWG
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                53 sử dụng giao thức
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                54

                v7. 0. 0

                Tham số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                v0. 1. 97

                Đã thêm vào. v0. 1. 97

                Thay đổi không đồng bộ chủ sở hữu và nhóm của tệp. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                Xem tài liệu POSIX

                import * as fs from 'node:fs';const fs = require['node:fs'];
                72 để biết thêm chi tiết

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                056

                Lịch sửPhiên bảnThay đổiv18. 0. 0

                Chuyển một cuộc gọi lại không hợp lệ cho đối số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 giờ sẽ ném
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                50 thay vì
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                51

                v15. 9. 0, v14. 17. 0

                Một cuộc gọi lại mặc định hiện được sử dụng nếu không được cung cấp

                v10. 0. 0

                Tham số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                83 khi chạy

                v7. 0. 0

                Tham số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                v0. 0. 2

                Đã thêm vào. v0. 0. 2

                Đóng bộ mô tả tập tin. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                Gọi

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                063 trên bất kỳ bộ mô tả tệp nào [
                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                064] hiện đang được sử dụng thông qua bất kỳ hoạt động
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                56 nào khác có thể dẫn đến hành vi không xác định

                Xem tài liệu POSIX

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                066 để biết thêm chi tiết

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                067

                Lịch sửPhiên bảnThay đổiv18. 0. 0

                Chuyển một cuộc gọi lại không hợp lệ cho đối số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 giờ sẽ ném
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                50 thay vì
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                51

                v14. 0. 0

                Đã thay đổi đối số

                import * as fs from 'node:fs';const fs = require['node:fs'];
                10 thành
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48 và áp đặt xác thực loại nghiêm ngặt hơn

                v8. 5. 0

                Đã thêm vào. v8. 5. 0

                Sao chép không đồng bộ

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                72 sang
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                73. Theo mặc định,
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                73 được ghi đè nếu nó đã tồn tại. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho hàm gọi lại. Nút. js không đảm bảo về tính nguyên tử của thao tác sao chép. Nếu xảy ra lỗi sau khi tệp đích đã được mở để ghi, Nút. js sẽ cố gắng xóa đích

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                48 là một số nguyên tùy chọn chỉ định hành vi của thao tác sao chép. Có thể tạo một mặt nạ bao gồm OR theo bit của hai hoặc nhiều giá trị [e. g.
                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                75]

                • import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  77. Thao tác sao chép sẽ thất bại nếu
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  73 đã tồn tại
                • import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  79. Thao tác sao chép sẽ cố gắng tạo liên kết giới thiệu sao chép khi ghi. Nếu nền tảng không hỗ trợ sao chép khi ghi, thì cơ chế sao chép dự phòng sẽ được sử dụng
                • import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  80. Thao tác sao chép sẽ cố gắng tạo liên kết giới thiệu sao chép khi ghi. Nếu nền tảng không hỗ trợ sao chép khi ghi, thì thao tác sẽ không thành công

                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                082

                Lịch sửPhiên bảnThay đổiv18. 0. 0

                Chuyển một cuộc gọi lại không hợp lệ cho đối số

                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                49 giờ sẽ ném
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                50 thay vì
                import { open } from 'node:fs/promises';
                
                const fd = await open['sample.txt'];
                fd.createReadStream[{ start: 90, end: 99 }];
                51

                v17. 6. 0, v16. 15. 0

                Chấp nhận tùy chọn

                import { unlink } from 'node:fs/promises';
                
                try {
                  await unlink['/tmp/hello'];
                  console.log['successfully deleted /tmp/hello'];
                } catch [error] {
                  console.error['there was an error:', error.message];
                }const { unlink } = require['node:fs/promises'];
                
                [async function[path] {
                  try {
                    await unlink[path];
                    console.log[`successfully deleted ${path}`];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }
                }]['/tmp/hello'];
                86 bổ sung để chỉ định có thực hiện phân giải đường dẫn cho liên kết tượng trưng hay không

                v16. 7. 0

                Đã thêm vào. v16. 7. 0

                • import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  72. đường dẫn nguồn để sao chép
                • import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  73. đường dẫn đích để sao chép vào
                • import * as fs from 'node:fs';const fs = require['node:fs'];
                  78
                  • import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    90 liên kết tượng trưng dereference. Mặc định.
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    01
                  • import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    92 khi
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    93 là
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    01 và đích tồn tại, đưa ra lỗi. Mặc định.
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    01
                  • import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    96 Chức năng lọc tập tin/thư mục sao chép. Trả lại
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    97 để sao chép mục này,
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    01 để bỏ qua nó. Cũng có thể trả về một
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    99 phân giải thành
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    97 hoặc
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    01 Mặc định.
                    import { open } from 'node:fs/promises';
                    
                    const fd = await open['sample.txt'];
                    fd.createReadStream[{ start: 90, end: 99 }];
                    6
                  • import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    93 ghi đè lên tệp hoặc thư mục hiện có. Thao tác sao chép sẽ bỏ qua lỗi nếu bạn đặt giá trị này thành false và đích tồn tại. Sử dụng tùy chọn
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    92 để thay đổi hành vi này. Mặc định.
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    97
                  • import { unlink } from 'node:fs';
                    
                    unlink['/tmp/hello', [err] => {
                      if [err] throw err;
                      console.log['successfully deleted /tmp/hello'];
                    }];const { unlink } = require['node:fs'];
                    
                    unlink['/tmp/hello', [err] => {
                      if [err] throw err;
                      console.log['successfully deleted /tmp/hello'];
                    }];
                    06 Khi dấu thời gian của
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    97 từ
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    72 sẽ được giữ nguyên. Mặc định.
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    01
                  • import { unlink } from 'node:fs';
                    
                    unlink['/tmp/hello', [err] => {
                      if [err] throw err;
                      console.log['successfully deleted /tmp/hello'];
                    }];const { unlink } = require['node:fs'];
                    
                    unlink['/tmp/hello', [err] => {
                      if [err] throw err;
                      console.log['successfully deleted /tmp/hello'];
                    }];
                    10 sao chép thư mục theo cách đệ quy Mặc định.
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    01
                  • import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    86 Khi
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    97, độ phân giải đường dẫn cho các liên kết tượng trưng sẽ bị bỏ qua. Mặc định.
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    01
                • import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49
                • Sao chép không đồng bộ toàn bộ cấu trúc thư mục từ

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  72 đến
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  73, bao gồm các thư mục con và tệp

                  Khi sao chép một thư mục sang một thư mục khác, khối cầu không được hỗ trợ và hành vi tương tự như

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  18

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  019

                  Lịch sửPhiên bảnThay đổiv16. 10. 0

                  Tùy chọn

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 không cần phương thức
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  11 nếu đã cung cấp một
                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064

                  v16. 10. 0

                  Tùy chọn

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 không cần phương pháp
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  024 nếu
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 là
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  01

                  v15. 4. 0

                  Tùy chọn

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 chấp nhận đối số FileHandle

                  v14. 0. 0

                  Thay đổi mặc định

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  00 thành
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  97

                  v13. 6. 0, v12. 17. 0

                  Các tùy chọn

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 cho phép ghi đè triển khai
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 đã sử dụng

                  v12. 10. 0

                  Bật tùy chọn

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  00

                  v11. 0. 0

                  Áp đặt các hạn chế mới đối với

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  79 và
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  80, đưa ra các lỗi phù hợp hơn trong trường hợp chúng tôi không thể xử lý các giá trị đầu vào một cách hợp lý

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 đã qua sẽ không bao giờ được sửa đổi

                  v2. 3. 0

                  Đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 đã qua có thể là một chuỗi bây giờ

                  v0. 1. 31

                  Đã thêm vào. v0. 1. 31

                  Không giống như 16 KiB mặc định

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  76 cho a , luồng được phương pháp này trả về có một
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  76 mặc định là 64 KiB

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 có thể bao gồm các giá trị
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  79 và
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  80 để đọc một phạm vi byte từ tệp thay vì toàn bộ tệp. Cả
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  79 và
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  80 đều bao gồm và bắt đầu đếm từ 0, các giá trị được phép nằm trong phạm vi [0,
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  83]. Nếu
                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 được chỉ định và
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  79 bị bỏ qua hoặc
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  6, thì
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  051 sẽ đọc tuần tự từ vị trí tệp hiện tại.
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 có thể là bất kỳ một trong số đó được chấp nhận bởi

                  Nếu

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 được chỉ định, thì
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  054 sẽ bỏ qua đối số
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 và sẽ sử dụng bộ mô tả tệp được chỉ định. Điều này có nghĩa là sẽ không có sự kiện
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  056 nào được phát ra.
                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 nên chặn;

                  Nếu

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 trỏ đến một thiết bị ký tự chỉ hỗ trợ chặn đọc [chẳng hạn như bàn phím hoặc card âm thanh], thì thao tác đọc sẽ không kết thúc cho đến khi có dữ liệu. Điều này có thể ngăn quá trình thoát và luồng đóng tự nhiên

                  Theo mặc định, luồng sẽ phát ra sự kiện

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  05 sau khi nó bị hủy. Đặt tùy chọn
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  00 thành
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  01 để thay đổi hành vi này

                  Bằng cách cung cấp tùy chọn

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56, có thể ghi đè các triển khai
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 tương ứng cho
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  11,
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  066 và
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  024. Khi cung cấp tùy chọn
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56, bắt buộc phải ghi đè cho
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  066. Nếu không cung cấp
                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064, thì cũng cần ghi đè cho
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  11. Nếu
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 là
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  97, thì cũng cần ghi đè cho
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  024

                  Nếu

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 là sai, thì bộ mô tả tệp sẽ không bị đóng, ngay cả khi có lỗi. Ứng dụng có trách nhiệm đóng nó và đảm bảo không có rò rỉ bộ mô tả tệp. Nếu
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 được đặt thành true [hành vi mặc định], trên
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  04 hoặc
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  05, bộ mô tả tệp sẽ tự động bị đóng

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  48 đặt chế độ tệp [quyền và bit dính], nhưng chỉ khi tệp được tạo

                  Một ví dụ để đọc 10 byte cuối cùng của tệp dài 100 byte

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  4

                  Nếu

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 là một chuỗi, thì nó chỉ định mã hóa

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  081

                  Lịch sửPhiên bảnThay đổiv16. 10. 0

                  Tùy chọn

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 không cần phương thức
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  11 nếu đã cung cấp một
                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064

                  v16. 10. 0

                  Tùy chọn

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 không cần phương pháp
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  024 nếu
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 là
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  01

                  v15. 4. 0

                  Tùy chọn

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 chấp nhận đối số FileHandle

                  v14. 0. 0

                  Thay đổi mặc định

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  00 thành
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  97

                  v13. 6. 0, v12. 17. 0

                  Các tùy chọn

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 cho phép ghi đè triển khai
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 đã sử dụng

                  v12. 10. 0

                  Bật tùy chọn

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  00

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 đã qua sẽ không bao giờ được sửa đổi

                  v5. 5. 0

                  Tùy chọn

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 hiện được hỗ trợ

                  v2. 3. 0

                  Đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 đã qua có thể là một chuỗi bây giờ

                  v0. 1. 31

                  Đã thêm vào. v0. 1. 31

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 cũng có thể bao gồm tùy chọn
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  79 để cho phép ghi dữ liệu ở một số vị trí sau phần đầu của tệp, các giá trị được phép nằm trong phạm vi [0,
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  83]. Sửa đổi một tệp thay vì thay thế nó có thể yêu cầu tùy chọn
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  10 được đặt thành
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  12 thay vì mặc định là
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  706.
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 có thể là bất kỳ một trong số đó được chấp nhận bởi

                  Nếu

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 được đặt thành true [hành vi mặc định] trên
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  04 hoặc
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  17, bộ mô tả tệp sẽ tự động bị đóng. Nếu
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 là sai, thì bộ mô tả tệp sẽ không bị đóng, ngay cả khi có lỗi. Ứng dụng có trách nhiệm đóng nó và đảm bảo không có rò rỉ bộ mô tả tệp

                  Theo mặc định, luồng sẽ phát ra sự kiện

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  05 sau khi nó bị hủy. Đặt tùy chọn
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  00 thành
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  01 để thay đổi hành vi này

                  Bằng cách cung cấp tùy chọn

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56, có thể ghi đè các triển khai
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56 tương ứng cho
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  11,
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  41,
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  719 và
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  024. Ghi đè
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  721 mà không có
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  45 có thể làm giảm hiệu suất vì một số tối ưu hóa [
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  723] sẽ bị vô hiệu hóa. Khi cung cấp tùy chọn
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  56, cần ghi đè ít nhất một trong số
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  41 và
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  719. Nếu không có tùy chọn
                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 nào được cung cấp, thì cũng cần ghi đè cho
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  11. Nếu
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  02 là
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  97, thì cũng cần ghi đè cho
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  024

                  Giống như, nếu

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 được chỉ định, sẽ bỏ qua đối số
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 và sẽ sử dụng bộ mô tả tệp được chỉ định. Điều này có nghĩa là sẽ không có sự kiện
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  056 nào được phát ra.
                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 nên chặn;

                  Nếu

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 là một chuỗi, thì nó chỉ định mã hóa

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  738

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v1. 0. 0

                  Không dùng nữa kể từ. v1. 0. 0

                  v0. 0. 2

                  Đã thêm vào. v0. 0. 2

                  Kiểm tra xem đường dẫn đã cho có tồn tại hay không bằng cách kiểm tra với hệ thống tệp. Sau đó gọi đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 với giá trị true hoặc false

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  5

                  Các tham số cho cuộc gọi lại này không nhất quán với các Nút khác. gọi lại js. Thông thường, tham số đầu tiên cho một Nút. js gọi lại là một tham số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  746, tùy chọn theo sau là các tham số khác. Cuộc gọi lại
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  747 chỉ có một tham số boolean. Đây là một lý do khiến
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  73 được đề xuất thay vì
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  747

                  Không nên sử dụng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  747 để kiểm tra sự tồn tại của tệp trước khi gọi
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  64,
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  75 hoặc
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  76. Làm như vậy sẽ đưa ra một điều kiện cạnh tranh, vì các quy trình khác có thể thay đổi trạng thái của tệp giữa hai lần gọi. Thay vào đó, mã người dùng nên mở/đọc/ghi tệp trực tiếp và xử lý lỗi phát sinh nếu tệp không tồn tại

                  viết [KHÔNG ĐƯỢC KHUYẾN NGHỊ]

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  6

                  viết [KHUYẾN NGHỊ]

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  7

                  đọc [KHÔNG ĐƯỢC KHUYẾN NGHỊ]

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  8

                  đọc [KHUYẾN NGHỊ]

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  9

                  Các ví dụ "không được đề xuất" ở trên kiểm tra sự tồn tại và sau đó sử dụng tệp;

                  Nói chung, chỉ kiểm tra sự tồn tại của tệp nếu tệp không được sử dụng trực tiếp, chẳng hạn như khi sự tồn tại của tệp là tín hiệu từ một quy trình khác

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  754

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 4. 7

                  Đã thêm vào. v0. 4. 7

                  Đặt quyền trên tệp. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  Xem tài liệu POSIX

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  761 để biết thêm chi tiết

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  762

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 4. 7

                  Đã thêm vào. v0. 4. 7

                  Đặt chủ sở hữu của tập tin. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  Xem tài liệu POSIX

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  769 để biết thêm chi tiết

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  770

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 1. 96

                  Đã thêm vào. v0. 1. 96

                  Buộc tất cả các hoạt động I/O được xếp hàng hiện tại được liên kết với tệp về trạng thái hoàn thành I/O được đồng bộ hóa của hệ điều hành. Tham khảo tài liệu POSIX

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  24 để biết chi tiết. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  778

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 5. 0

                  Chấp nhận một đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 1. 95

                  Đã thêm vào. v0. 1. 95

                  Gọi lại cuộc gọi với bộ mô tả tệp for

                  Xem tài liệu POSIX

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  786 để biết thêm chi tiết

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  787

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 1. 96

                  Đã thêm vào. v0. 1. 96

                  Yêu cầu tất cả dữ liệu cho bộ mô tả tệp mở được chuyển sang thiết bị lưu trữ. Việc triển khai cụ thể là hệ điều hành và thiết bị cụ thể. Tham khảo tài liệu POSIX

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  83 để biết thêm chi tiết. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  795

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 8. 6

                  Đã thêm vào. v0. 8. 6

                  Cắt bớt bộ mô tả tập tin. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  Xem tài liệu POSIX

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  802 để biết thêm chi tiết

                  Nếu tệp được tham chiếu bởi bộ mô tả tệp lớn hơn

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  85 byte, thì chỉ
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  85 byte đầu tiên sẽ được giữ lại trong tệp

                  Ví dụ: chương trình sau chỉ giữ lại bốn byte đầu tiên của tệp

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  0

                  Nếu tệp trước đó ngắn hơn

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  85 byte, nó sẽ được mở rộng và phần mở rộng chứa đầy byte rỗng [
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  88]

                  Nếu

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  85 âm thì sẽ sử dụng
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  39

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  809

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v4. 1. 0

                  Các chuỗi số,

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  07 và
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  08 hiện được phép xác định thời gian

                  v0. 4. 2

                  Đã thêm vào. v0. 4. 2

                  Thay đổi dấu thời gian hệ thống tệp của đối tượng được tham chiếu bởi bộ mô tả tệp được cung cấp. Nhìn thấy

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  819

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v16. 0. 0

                  Lỗi được trả về có thể là

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  823 nếu có nhiều hơn một lỗi được trả về

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 4. 7

                  Không dùng nữa kể từ. v0. 4. 7

                  Thay đổi quyền trên một liên kết tượng trưng. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  Phương pháp này chỉ được thực hiện trên macOS

                  Xem tài liệu POSIX

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  827 để biết thêm chi tiết

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  828

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 6. 0

                  API này không còn được dùng nữa

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 4. 7

                  Ngừng sử dụng tài liệu chỉ

                  Đặt chủ sở hữu của liên kết tượng trưng. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  Xem tài liệu POSIX

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  835 để biết thêm chi tiết

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  836

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v14. 5. 0, v12. 19. 0

                  Đã thêm vào. v14. 5. 0, v12. 19. 0

                  Thay đổi thời gian truy cập và sửa đổi của một tệp giống như cách thay đổi, với điểm khác biệt là nếu đường dẫn đề cập đến một liên kết tượng trưng, ​​thì liên kết đó không được hủy đăng ký. thay vào đó, dấu thời gian của chính liên kết tượng trưng được thay đổi

                  Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  841

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 6. 0

                  Các tham số

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  24 và
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  25 có thể là các đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54. Hỗ trợ hiện vẫn đang thử nghiệm

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 1. 31

                  Đã thêm vào. v0. 1. 31

                  Tạo một liên kết mới từ ________ 624 đến ________ 625. Xem tài liệu POSIX

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  26 để biết thêm chi tiết. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  855

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 5. 0

                  Chấp nhận một đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 1. 30

                  Đã thêm vào. v0. 1. 30

                  Truy xuất liên kết tượng trưng được tham chiếu bởi đường dẫn. Cuộc gọi lại nhận được hai đối số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  866 trong đó
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  867 là một đối tượng.
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  868 giống với
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  869, ngoại trừ nếu
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 là một liên kết tượng trưng, ​​thì chính liên kết đó đã được thống kê, không phải tệp mà nó đề cập đến

                  Xem tài liệu POSIX

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  31 để biết thêm chi tiết

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  872

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v13. 11. 0, v12. 17. 0

                  Ở chế độ

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10, cuộc gọi lại hiện nhận đường dẫn được tạo đầu tiên làm đối số

                  v10. 12. 0

                  Đối số thứ hai bây giờ có thể là một đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 với các thuộc tính
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10 và
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  48

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 1. 8

                  Đã thêm vào. v0. 1. 8

                  Tạo thư mục không đồng bộ

                  Cuộc gọi lại được đưa ra một ngoại lệ có thể xảy ra và, nếu

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10 là
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  97, đường dẫn thư mục đầu tiên được tạo,
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  888.
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 vẫn có thể là
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  6 khi
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10 là
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  97, nếu không có thư mục nào được tạo

                  Đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 tùy chọn có thể là một số nguyên chỉ định
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  48 [các bit quyền và dính] hoặc một đối tượng có thuộc tính
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  48 và thuộc tính
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10 cho biết có nên tạo thư mục mẹ hay không. Gọi
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  897 khi
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 là một thư mục tồn tại chỉ dẫn đến lỗi khi
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10 sai

                  Trên Windows, sử dụng

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  897 trên thư mục gốc ngay cả với đệ quy sẽ dẫn đến lỗi

                  Xem tài liệu POSIX

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  001 để biết thêm chi tiết

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  002

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v16. 5. 0, v14. 18. 0

                  Tham số

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  41 hiện chấp nhận một chuỗi rỗng

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v6. 2. 1

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 bây giờ là tùy chọn

                  v5. 10. 0

                  Đã thêm vào. v5. 10. 0

                  Tạo một thư mục tạm thời duy nhất

                  Tạo sáu ký tự ngẫu nhiên được thêm vào sau một

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  41 bắt buộc để tạo một thư mục tạm thời duy nhất. Do sự không nhất quán của nền tảng, hãy tránh sử dụng các ký tự
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  43 trong
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  41. Một số nền tảng, đặc biệt là BSD, có thể trả về nhiều hơn sáu ký tự ngẫu nhiên và thay thế các ký tự
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  43 ở cuối trong
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  41 bằng các ký tự ngẫu nhiên

                  Đường dẫn thư mục đã tạo được truyền dưới dạng chuỗi tới tham số thứ hai của hàm gọi lại

                  Đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 tùy chọn có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 chỉ định mã hóa ký tự sẽ sử dụng

                  Phương thức

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  018 sẽ nối trực tiếp sáu ký tự được chọn ngẫu nhiên vào chuỗi
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  41. Ví dụ: được cung cấp một thư mục
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  51, nếu mục đích là tạo một thư mục tạm thời trong
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  51, thì ____641 phải kết thúc bằng dấu phân cách đường dẫn dành riêng cho nền tảng [
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  54]

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  024

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v11. 1. 0

                  Đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  10 hiện là tùy chọn và mặc định là
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  57

                  v9. 9. 0

                  Các cờ ________ 2030 và ________ 2031 hiện được hỗ trợ

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v0. 0. 2

                  Đã thêm vào. v0. 0. 2

                  Mở tệp không đồng bộ. Xem tài liệu POSIX

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  58 để biết thêm chi tiết

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  48 đặt chế độ tệp [quyền và bit dính], nhưng chỉ khi tệp được tạo. Trên Windows, chỉ có thể thao tác quyền ghi;

                  Cuộc gọi lại nhận được hai đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  038

                  Một số ký tự [

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  59] được dành riêng trong Windows như được ghi lại bằng cách đặt tên tệp, đường dẫn và không gian tên. Trong NTFS, nếu tên tệp chứa dấu hai chấm, Nút. js sẽ mở một luồng hệ thống tệp, như được mô tả bởi this MSDN page

                  Các chức năng dựa trên

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  64 cũng thể hiện hành vi này.
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  76,
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  75, v.v.

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  043

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v13. 1. 0, v12. 16. 0

                  Tùy chọn

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  61 đã được giới thiệu

                  v12. 12. 0

                  Đã thêm vào. v12. 12. 0

                  Mở thư mục không đồng bộ. Xem tài liệu POSIX

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  62 để biết thêm chi tiết

                  Tạo một , chứa tất cả các chức năng khác để đọc và dọn dẹp thư mục

                  Tùy chọn

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 đặt mã hóa cho
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 trong khi mở thư mục và các thao tác đọc tiếp theo

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  051

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 10. 0

                  Tham số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  28 bây giờ có thể là bất kỳ
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  056 nào, hoặc một
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  057

                  v7. 4. 0

                  Tham số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  28 bây giờ có thể là một
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  059

                  v6. 0. 0

                  Tham số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  30 bây giờ có thể là
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  39

                  v0. 0. 2

                  Đã thêm vào. v0. 0. 2

                  • import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                    064
                  • import * as fs from 'node:fs';const fs = require['node:fs'];
                    28. . Bộ đệm mà dữ liệu sẽ được ghi vào
                  • import * as fs from 'node:fs';const fs = require['node:fs'];
                    29 Vị trí trong
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    28 để ghi dữ liệu vào
                  • import * as fs from 'node:fs';const fs = require['node:fs'];
                    30 Số byte cần đọc
                  • import * as fs from 'node:fs';const fs = require['node:fs'];
                    31. . Chỉ định nơi bắt đầu đọc từ trong tệp. Nếu
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    31 là
                    import { open } from 'node:fs/promises';
                    
                    const fd = await open['sample.txt'];
                    fd.createReadStream[{ start: 90, end: 99 }];
                    5 hoặc
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    070, dữ liệu sẽ được đọc từ vị trí tệp hiện tại và vị trí tệp sẽ được cập nhật. Nếu
                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    31 là số nguyên, vị trí tệp sẽ không thay đổi
                  • import { open } from 'node:fs/promises';
                    
                    const fd = await open['sample.txt'];
                    fd.createReadStream[{ start: 90, end: 99 }];
                    49

                  Đọc dữ liệu từ tệp được chỉ định bởi

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064

                  Cuộc gọi lại được đưa ra ba đối số,

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  074

                  Nếu tệp không được sửa đổi đồng thời, thì kết thúc tệp đạt được khi số byte được đọc bằng 0

                  Nếu phương thức này được gọi dưới dạng phiên bản chỉnh sửa của nó, thì nó sẽ trả về một lời hứa cho một

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  076 với các thuộc tính
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  077 và
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  28

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  079

                  Lịch sửPhiên bảnThay đổiv13. 11. 0, v12. 17. 0

                  Đã thêm vào. v13. 11. 0, v12. 17. 0

                  v13. 11. 0, v12. 17. 0

                  Đối tượng tùy chọn có thể được chuyển vào để tạo bộ đệm, độ lệch, độ dài và vị trí tùy chọn

                  Tương tự như chức năng, phiên bản này có một đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 tùy chọn. Nếu không có đối tượng
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 nào được chỉ định, nó sẽ mặc định với các giá trị trên

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  083

                  Đã thêm vào. v18. 2. 0, v16. 17. 0

                  Tương tự như chức năng, phiên bản này có một đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 tùy chọn. Nếu không có đối tượng
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 nào được chỉ định, nó sẽ mặc định với các giá trị trên

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  087

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 10. 0

                  Tùy chọn mới

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  66 đã được thêm vào

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v6. 0. 0

                  Tham số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 đã được thêm vào

                  v0. 1. 8

                  Đã thêm vào. v0. 1. 8

                  Đọc nội dung của một thư mục. Cuộc gọi lại nhận được hai đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  099 trong đó
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  100 là một mảng tên của các tệp trong thư mục ngoại trừ
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  101 và
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  102

                  Xem tài liệu POSIX

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  103 để biết thêm chi tiết

                  Đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 tùy chọn có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 chỉ định mã hóa ký tự sẽ sử dụng cho tên tệp được chuyển đến hàm gọi lại. Nếu
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 được đặt thành
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  70, tên tệp được trả về sẽ được chuyển dưới dạng đối tượng

                  Nếu

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  71 được đặt thành
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  97, mảng
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  100 sẽ chứa các đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  111

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v16. 0. 0

                  Lỗi được trả về có thể là

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  823 nếu có nhiều hơn một lỗi được trả về

                  v15. 2. 0, v14. 17. 0

                  Đối số tùy chọn có thể bao gồm AbortSignal để hủy bỏ yêu cầu readFile đang diễn ra

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v5. 1. 0

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 sẽ luôn được gọi với
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  5 là tham số
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  124 trong trường hợp thành công

                  v5. 0. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 hiện có thể là một bộ mô tả tệp

                  v0. 1. 29

                  Đã thêm vào. v0. 1. 29

                  Đọc không đồng bộ toàn bộ nội dung của một tệp

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  1

                  Cuộc gọi lại được thông qua hai đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  126, trong đó
                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  08 là nội dung của tệp

                  Nếu không có mã hóa nào được chỉ định, thì bộ đệm thô được trả về

                  Nếu

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 là một chuỗi, thì nó chỉ định mã hóa

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  2

                  Khi đường dẫn là một thư mục, hành vi của

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  75 và dành riêng cho nền tảng. Trên macOS, Linux và Windows, một lỗi sẽ được trả về. Trên FreeBSD, nội dung của thư mục sẽ được trả về

                  Có thể hủy bỏ một yêu cầu đang diễn ra bằng cách sử dụng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  131. Nếu một yêu cầu bị hủy bỏ, cuộc gọi lại được gọi với một
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  80

                  Hàm

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  75 đệm toàn bộ tệp. Để giảm thiểu chi phí bộ nhớ, khi có thể, hãy ưu tiên phát trực tuyến qua
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  051

                  Việc hủy bỏ một yêu cầu đang diễn ra không hủy bỏ các yêu cầu riêng lẻ của hệ điều hành mà thay vào đó, bộ đệm nội bộ

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  81 thực hiện

                  bộ mô tả tệp
                  1. Bất kỳ bộ mô tả tệp được chỉ định nào cũng phải hỗ trợ đọc
                  2. Nếu một bộ mô tả tệp được chỉ định là
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    47, nó sẽ không tự động bị đóng
                  3. Việc đọc sẽ bắt đầu ở vị trí hiện tại. Ví dụ: nếu tệp đã có _____2137' và sáu byte được đọc với bộ mô tả tệp, lệnh gọi tới _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ với _ _ _ _ _ _ _ _ _ _ _ với _ _ _ _ _ _ _ _ _ với _ _ _ _ _ _ _ _ _ _ với _ _ _ _ _ _ _ _ _ _ _ _ _ với _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
                  Cân nhắc hiệu suất

                  Phương thức

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  75 đọc không đồng bộ nội dung của tệp vào bộ nhớ từng đoạn một, cho phép vòng lặp sự kiện chuyển giữa từng đoạn. Điều này cho phép thao tác đọc ít ảnh hưởng đến hoạt động khác có thể đang sử dụng nhóm luồng libuv cơ bản nhưng có nghĩa là sẽ mất nhiều thời gian hơn để đọc một tệp hoàn chỉnh vào bộ nhớ

                  Chi phí đọc bổ sung có thể rất khác nhau trên các hệ thống khác nhau và tùy thuộc vào loại tệp đang được đọc. Nếu loại tệp không phải là tệp thông thường [ví dụ: đường ống] và Nút. js không thể xác định kích thước tệp thực tế, mỗi thao tác đọc sẽ tải trên 64 KiB dữ liệu. Đối với các tệp thông thường, mỗi lần đọc sẽ xử lý 512 KiB dữ liệu

                  Đối với các ứng dụng yêu cầu đọc nội dung tệp nhanh nhất có thể, tốt hơn là sử dụng trực tiếp

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  080 và mã ứng dụng để quản lý việc đọc toàn bộ nội dung của tệp

                  nút. js GitHub issue #25741 cung cấp thêm thông tin và phân tích chi tiết về hiệu suất của

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  75 cho nhiều kích thước tệp trong các Nút khác nhau. phiên bản js

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  144

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 1. 31

                  Đã thêm vào. v0. 1. 31

                  Đọc nội dung của liên kết tượng trưng được gọi bởi

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47. Cuộc gọi lại nhận được hai đối số
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  155

                  Xem tài liệu POSIX

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  84 để biết thêm chi tiết

                  Đối số tùy chọn

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 có thể là một chuỗi chỉ định mã hóa hoặc một đối tượng có thuộc tính
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 chỉ định mã hóa ký tự sẽ sử dụng cho đường dẫn liên kết được chuyển đến hàm gọi lại. Nếu
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 được đặt thành
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  70, đường dẫn liên kết được trả về sẽ được chuyển dưới dạng đối tượng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  161

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v13. 13. 0, v12. 17. 0

                  Đã thêm vào. v13. 13. 0, v12. 17. 0

                  Đọc từ một tệp được chỉ định bởi

                  import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                  064 và ghi vào một mảng gồm các
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  166 bằng cách sử dụng
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  167

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  31 là phần bù từ đầu tệp từ nơi dữ liệu sẽ được đọc. Nếu
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  169, dữ liệu sẽ được đọc từ vị trí hiện tại

                  Cuộc gọi lại sẽ được đưa ra ba đối số.

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  746,
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  077 và
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  74.
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  077 là số byte đã được đọc từ tệp

                  Nếu phương thức này được gọi dưới dạng phiên bản chỉnh sửa của nó, thì nó sẽ trả về một lời hứa cho một

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  076 với các thuộc tính
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  077 và
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  74

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  178

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v8. 0. 0

                  Hỗ trợ giải quyết đường ống/ổ cắm đã được thêm vào

                  v7. 6. 0

                  Tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v6. 4. 0

                  Gọi

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  188 hiện đã hoạt động trở lại đối với các trường hợp cạnh khác nhau trên Windows

                  v6. 0. 0

                  Tham số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  189 đã bị xóa

                  v0. 1. 31

                  Đã thêm vào. v0. 1. 31

                  Tính toán không đồng bộ tên đường dẫn chính tắc bằng cách giải quyết các liên kết

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  190,
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  191 và tượng trưng

                  Một tên đường dẫn chính tắc không nhất thiết phải là duy nhất. Liên kết cứng và gắn kết liên kết có thể hiển thị một thực thể hệ thống tệp thông qua nhiều tên đường dẫn

                  Chức năng này hoạt động giống như

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  192, với một số ngoại lệ

                  1. Không có chuyển đổi chữ hoa chữ thường được thực hiện trên các hệ thống tệp không phân biệt chữ hoa chữ thường

                  2. Số lượng liên kết tượng trưng tối đa không phụ thuộc vào nền tảng và thường cao hơn [nhiều] so với những gì mà triển khai

                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    192 gốc hỗ trợ

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 có hai đối số
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  195. Có thể sử dụng
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  196 để giải quyết các đường dẫn tương đối

                  Chỉ hỗ trợ các đường dẫn có thể chuyển đổi thành chuỗi UTF8

                  Đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 tùy chọn có thể là một chuỗi chỉ định mã hóa hoặc một đối tượng có thuộc tính
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 chỉ định mã hóa ký tự sẽ sử dụng cho đường dẫn được chuyển đến lệnh gọi lại. Nếu
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 được đặt thành
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  70, đường dẫn được trả về sẽ được truyền dưới dạng đối tượng

                  Nếu

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 phân giải thành ổ cắm hoặc đường ống, hàm sẽ trả về tên phụ thuộc hệ thống cho đối tượng đó

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  202

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v9. 2. 0

                  Đã thêm vào. v9. 2. 0

                  Không đồng bộ

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  192

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 có hai đối số
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  195

                  Chỉ hỗ trợ các đường dẫn có thể chuyển đổi thành chuỗi UTF8

                  Đối số

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  78 tùy chọn có thể là một chuỗi chỉ định mã hóa hoặc một đối tượng có thuộc tính
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 chỉ định mã hóa ký tự sẽ sử dụng cho đường dẫn được chuyển đến lệnh gọi lại. Nếu
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  87 được đặt thành
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  70, đường dẫn được trả về sẽ được truyền dưới dạng đối tượng

                  Trên Linux, khi nút. js được liên kết với musl libc, hệ thống tệp procfs phải được gắn trên

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  97 để chức năng này hoạt động. Glibc không có hạn chế này

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  214

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 6. 0

                  Các tham số

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  99 và
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  25 có thể là các đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54. Hỗ trợ hiện vẫn đang thử nghiệm

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 0. 2

                  Đã thêm vào. v0. 0. 2

                  Đổi tên tệp không đồng bộ tại

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  99 thành tên đường dẫn được cung cấp dưới dạng
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  25. Trong trường hợp
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  25 đã tồn tại, nó sẽ bị ghi đè. Nếu có một thư mục tại
                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  25, thay vào đó sẽ xảy ra lỗi. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                  Xem thêm.

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  229

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  3

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  230

                  Lịch sửPhiên bảnThay đổiv18. 0. 0

                  Chuyển một cuộc gọi lại không hợp lệ cho đối số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 giờ sẽ ném
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  50 thay vì
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  51

                  v16. 0. 0

                  Sử dụng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  234 trên một tệp
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 không còn được phép và dẫn đến lỗi
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  204 trên Windows và lỗi
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  205 trên POSIX

                  v16. 0. 0

                  Việc sử dụng

                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  234 trên một
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 không tồn tại sẽ không còn được phép và dẫn đến lỗi
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  204

                  v16. 0. 0

                  Tùy chọn

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10 không được dùng nữa, sử dụng tùy chọn này sẽ kích hoạt cảnh báo không dùng nữa

                  v14. 14. 0

                  Tùy chọn

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10 không được dùng nữa, thay vào đó hãy sử dụng
                  import * as fs from 'node:fs';const fs = require['node:fs'];
                  243

                  v13. 3. 0, v12. 16. 0

                  Tùy chọn

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  212 được đổi tên thành
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  213 và giá trị mặc định là 0. Tùy chọn
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  214 đã bị xóa và các lỗi
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  215 sử dụng logic thử lại giống như các lỗi khác. Tùy chọn
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  216 hiện được hỗ trợ. Lỗi
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  217 hiện đã được thử lại

                  v12. 10. 0

                  Các tùy chọn

                  import { unlink } from 'node:fs';
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];const { unlink } = require['node:fs'];
                  
                  unlink['/tmp/hello', [err] => {
                    if [err] throw err;
                    console.log['successfully deleted /tmp/hello'];
                  }];
                  10,
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  212 và
                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  214 hiện đã được hỗ trợ

                  v10. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  83 khi chạy

                  v7. 6. 0

                  Các tham số

                  import { unlink } from 'node:fs/promises';
                  
                  try {
                    await unlink['/tmp/hello'];
                    console.log['successfully deleted /tmp/hello'];
                  } catch [error] {
                    console.error['there was an error:', error.message];
                  }const { unlink } = require['node:fs/promises'];
                  
                  [async function[path] {
                    try {
                      await unlink[path];
                      console.log[`successfully deleted ${path}`];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }
                  }]['/tmp/hello'];
                  47 có thể là một đối tượng WHATWG
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  53 sử dụng giao thức
                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  54

                  v7. 0. 0

                  Tham số

                  import { open } from 'node:fs/promises';
                  
                  const fd = await open['sample.txt'];
                  fd.createReadStream[{ start: 90, end: 99 }];
                  49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                  v0. 0. 2

                  Đã thêm vào. v0. 0. 2

                  • import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    47. .
                  • import * as fs from 'node:fs';const fs = require['node:fs'];
                    78
                    • import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      213 Nếu gặp lỗi
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      224,
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      215,
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      217,
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      227 hoặc
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      228, Nút. js thử lại thao tác với thời gian chờ dự phòng tuyến tính dài hơn
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      216 mili giây cho mỗi lần thử. Tùy chọn này đại diện cho số lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                      import { unlink } from 'node:fs';
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];const { unlink } = require['node:fs'];
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];
                      10 không phải là
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      97. Mặc định.
                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      39
                    • import { unlink } from 'node:fs';
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];const { unlink } = require['node:fs'];
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];
                      10 Nếu
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      97, thực hiện xóa thư mục đệ quy. Trong chế độ đệ quy, các hoạt động được thử lại khi thất bại. Mặc định.
                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      01. không dùng nữa
                    • import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      216 Lượng thời gian tính bằng mili giây để chờ giữa các lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                      import { unlink } from 'node:fs';
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];const { unlink } = require['node:fs'];
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];
                      10 không phải là
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      97. Mặc định.
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      239
                  • import { open } from 'node:fs/promises';
                    
                    const fd = await open['sample.txt'];
                    fd.createReadStream[{ start: 90, end: 99 }];
                    49
                  • Không đồng bộ

                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    279. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                    Sử dụng

                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    280 trên tệp [không phải thư mục] dẫn đến lỗi
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    204 trên Windows và lỗi
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    205 trên POSIX

                    Để có hành vi tương tự như lệnh

                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    245 Unix, hãy sử dụng với các tùy chọn
                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    247

                    import * as fs from 'node:fs';const fs = require['node:fs'];
                    286

                    Lịch sửPhiên bảnThay đổiv17. 3. 0, v16. 14. 0

                    Tham số

                    import { unlink } from 'node:fs/promises';
                    
                    try {
                      await unlink['/tmp/hello'];
                      console.log['successfully deleted /tmp/hello'];
                    } catch [error] {
                      console.error['there was an error:', error.message];
                    }const { unlink } = require['node:fs/promises'];
                    
                    [async function[path] {
                      try {
                        await unlink[path];
                        console.log[`successfully deleted ${path}`];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }
                    }]['/tmp/hello'];
                    47 có thể là một đối tượng WHATWG
                    import { open } from 'node:fs/promises';
                    
                    const fd = await open['sample.txt'];
                    fd.createReadStream[{ start: 90, end: 99 }];
                    53 sử dụng giao thức
                    import { open } from 'node:fs/promises';
                    
                    const fd = await open['sample.txt'];
                    fd.createReadStream[{ start: 90, end: 99 }];
                    54

                    v14. 14. 0

                    Đã thêm vào. v14. 14. 0

                    • import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      47. .
                    • import * as fs from 'node:fs';const fs = require['node:fs'];
                      78
                      • import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        93 Khi
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        97, các ngoại lệ sẽ bị bỏ qua nếu
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        47 không tồn tại. Mặc định.
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        01
                      • import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        213 Nếu gặp lỗi
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        224,
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        215,
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        217,
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        227 hoặc
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        228, Nút. js sẽ thử lại thao tác với thời gian chờ tắt tuyến tính dài hơn
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        216 mili giây cho mỗi lần thử. Tùy chọn này đại diện cho số lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                        import { unlink } from 'node:fs';
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];const { unlink } = require['node:fs'];
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];
                        10 không phải là
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        97. Mặc định.
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        39
                      • import { unlink } from 'node:fs';
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];const { unlink } = require['node:fs'];
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];
                        10 Nếu
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        97, thực hiện loại bỏ đệ quy. Trong chế độ đệ quy, các hoạt động được thử lại khi thất bại. Mặc định.
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        01
                      • import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        216 Lượng thời gian tính bằng mili giây để chờ giữa các lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                        import { unlink } from 'node:fs';
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];const { unlink } = require['node:fs'];
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];
                        10 không phải là
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        97. Mặc định.
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        239
                    • import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49
                    • Xóa không đồng bộ các tệp và thư mục [được mô phỏng theo tiện ích POSIX

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      273 tiêu chuẩn]. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      315

                      Lịch sửPhiên bảnThay đổiv18. 0. 0

                      Chuyển một cuộc gọi lại không hợp lệ cho đối số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 giờ sẽ ném
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      50 thay vì
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      51

                      v10. 5. 0

                      Chấp nhận một đối tượng

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

                      v10. 0. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      83 khi chạy

                      v7. 6. 0

                      Tham số

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      47 có thể là một đối tượng WHATWG
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      53 sử dụng giao thức
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      54

                      v7. 0. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                      v0. 0. 2

                      Đã thêm vào. v0. 0. 2

                      Không đồng bộ

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      326. Cuộc gọi lại nhận được hai đối số
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      866 trong đó
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      867 là một đối tượng

                      Trong trường hợp có lỗi,

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      329 sẽ là một trong

                      Không nên sử dụng

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      330 để kiểm tra sự tồn tại của tệp trước khi gọi
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      64,
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      75 hoặc
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      76. Thay vào đó, mã người dùng nên trực tiếp mở/đọc/ghi tệp và xử lý lỗi phát sinh nếu tệp không khả dụng

                      Để kiểm tra xem một tệp có tồn tại mà không cần thao tác với nó sau đó hay không, nên

                      Ví dụ, đưa ra cấu trúc thư mục sau

                      import { unlink } from 'node:fs';
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];const { unlink } = require['node:fs'];
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];
                      4

                      Chương trình tiếp theo sẽ kiểm tra số liệu thống kê của các đường dẫn đã cho

                      import { unlink } from 'node:fs';
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];const { unlink } = require['node:fs'];
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];
                      5

                      Đầu ra kết quả sẽ giống như

                      import { unlink } from 'node:fs';
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];const { unlink } = require['node:fs'];
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];
                      6

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      335

                      Lịch sửPhiên bảnThay đổiv18. 0. 0

                      Chuyển một cuộc gọi lại không hợp lệ cho đối số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 giờ sẽ ném
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      50 thay vì
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      51

                      v12. 0. 0

                      Nếu đối số

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      277 không được xác định, Node sẽ tự động phát hiện loại
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      279 và tự động chọn
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      280 hoặc
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      281

                      v7. 6. 0

                      Các tham số

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      279 và
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      47 có thể là các đối tượng WHATWG
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      53 sử dụng giao thức
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      54. Hỗ trợ hiện vẫn đang thử nghiệm

                      v0. 1. 31

                      Đã thêm vào. v0. 1. 31

                      Tạo liên kết có tên ________ 347 trỏ đến ______ 3279. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                      Xem tài liệu POSIX

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      349 để biết thêm chi tiết

                      Đối số

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      277 chỉ khả dụng trên Windows và bị bỏ qua trên các nền tảng khác. Nó có thể được đặt thành
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      283,
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      284 hoặc
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      285. Nếu đối số
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      277 không phải là một chuỗi, Nút. js sẽ tự động phát hiện loại
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      279 và sử dụng
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      284 hoặc
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      283. Nếu
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      279 không tồn tại,
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      284 sẽ được sử dụng. Các điểm giao nhau của Windows yêu cầu đường dẫn đích phải tuyệt đối. Khi sử dụng
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      285, đối số
                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      279 sẽ tự động được chuẩn hóa thành đường dẫn tuyệt đối

                      Các mục tiêu tương đối có liên quan đến thư mục mẹ của liên kết

                      import { unlink } from 'node:fs';
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];const { unlink } = require['node:fs'];
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];
                      7

                      Ví dụ trên tạo một liên kết tượng trưng

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      362 trỏ đến
                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      363 trong cùng một thư mục

                      import { unlink } from 'node:fs';
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];const { unlink } = require['node:fs'];
                      
                      unlink['/tmp/hello', [err] => {
                        if [err] throw err;
                        console.log['successfully deleted /tmp/hello'];
                      }];
                      8

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      364

                      Lịch sửPhiên bảnThay đổiv18. 0. 0

                      Chuyển một cuộc gọi lại không hợp lệ cho đối số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 giờ sẽ ném
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      50 thay vì
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      51

                      v16. 0. 0

                      Lỗi được trả về có thể là

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      823 nếu có nhiều hơn một lỗi được trả về

                      v10. 0. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      83 khi chạy

                      v7. 0. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                      v0. 8. 6

                      Đã thêm vào. v0. 8. 6

                      Cắt bớt tập tin. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành. Một bộ mô tả tệp cũng có thể được chuyển làm đối số đầu tiên. Trong trường hợp này,

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      372 được gọi là

                      Truyền một bộ mô tả tệp không được dùng nữa và có thể dẫn đến lỗi trong tương lai

                      Xem tài liệu POSIX

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      373 để biết thêm chi tiết

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      374

                      Lịch sửPhiên bảnThay đổiv18. 0. 0

                      Chuyển một cuộc gọi lại không hợp lệ cho đối số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 giờ sẽ ném
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      50 thay vì
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      51

                      v10. 0. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      83 khi chạy

                      v7. 6. 0

                      Tham số

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      47 có thể là một đối tượng WHATWG
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      53 sử dụng giao thức
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      54

                      v7. 0. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                      v0. 0. 2

                      Đã thêm vào. v0. 0. 2

                      Xóa không đồng bộ tệp hoặc liên kết tượng trưng. Không có đối số nào khác ngoài một ngoại lệ có thể được đưa ra cho cuộc gọi lại hoàn thành

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      384 sẽ không hoạt động trên một thư mục, trống hoặc cách khác. Để xóa một thư mục, hãy sử dụng

                      Xem tài liệu POSIX

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      00 để biết thêm chi tiết

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      387

                      Ngừng theo dõi các thay đổi trên

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      12. Nếu
                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      389 được chỉ định, chỉ người nghe cụ thể đó bị xóa. Nếu không, tất cả người nghe sẽ bị xóa, ngừng xem
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      12 một cách hiệu quả

                      Gọi

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      391 với tên tệp không được xem là không hoạt động, không phải lỗi

                      Sử dụng hiệu quả hơn

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      393 và
                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      391. Nên sử dụng
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      24 thay cho
                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      393 và
                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      391 khi có thể

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      398

                      Lịch sửPhiên bảnThay đổiv18. 0. 0

                      Chuyển một cuộc gọi lại không hợp lệ cho đối số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 giờ sẽ ném
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      50 thay vì
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      51

                      v10. 0. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      83 khi chạy

                      v8. 0. 0

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      07,
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      08, và
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      09 không còn là bộ chỉ định thời gian hợp lệ

                      v7. 6. 0

                      Tham số

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      47 có thể là một đối tượng WHATWG
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      53 sử dụng giao thức
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      54

                      v7. 0. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                      v4. 1. 0

                      Các chuỗi số,

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      07 và
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      08 hiện được phép xác định thời gian

                      v0. 4. 2

                      Đã thêm vào. v0. 4. 2

                      Thay đổi dấu thời gian hệ thống tệp của đối tượng được tham chiếu bởi

                      import { unlink } from 'node:fs/promises';
                      
                      try {
                        await unlink['/tmp/hello'];
                        console.log['successfully deleted /tmp/hello'];
                      } catch [error] {
                        console.error['there was an error:', error.message];
                      }const { unlink } = require['node:fs/promises'];
                      
                      [async function[path] {
                        try {
                          await unlink[path];
                          console.log[`successfully deleted ${path}`];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }
                      }]['/tmp/hello'];
                      47

                      Các đối số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      03 và
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      04 tuân theo các quy tắc này

                      • Các giá trị có thể là các số đại diện cho thời gian Unix Epoch tính bằng giây,
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        05 giây hoặc một chuỗi số như
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        06
                      • Nếu giá trị không thể được chuyển đổi thành một số hoặc là
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        07,
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        08 hoặc
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        09, một
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        10 sẽ bị ném

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      422

                      Lịch sửPhiên bảnThay đổiv19. 1. 0

                      Đã thêm hỗ trợ đệ quy cho Linux, AIX và IBMi

                      v15. 9. 0, v14. 17. 0

                      Đã thêm hỗ trợ để đóng trình theo dõi bằng AbortSignal

                      v7. 6. 0

                      Tham số

                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      12 có thể là một đối tượng WHATWG
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      53 sử dụng giao thức
                      import { open } from 'node:fs/promises';
                      
                      const fd = await open['sample.txt'];
                      fd.createReadStream[{ start: 90, end: 99 }];
                      54

                      v7. 0. 0

                      Đối tượng

                      import * as fs from 'node:fs';const fs = require['node:fs'];
                      78 đã qua sẽ không bao giờ được sửa đổi

                      v0. 5. 10

                      Đã thêm vào. v0. 5. 10

                      • import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12. .
                      • import * as fs from 'node:fs';const fs = require['node:fs'];
                        78.
                        • import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          14 Cho biết liệu quy trình có nên tiếp tục chạy miễn là các tệp đang được xem hay không. Mặc định.
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          97
                        • import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          10 Cho biết nên xem tất cả các thư mục con hay chỉ thư mục hiện tại. Điều này áp dụng khi một thư mục được chỉ định và chỉ trên các nền tảng được hỗ trợ [Xem ]. Mặc định.
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          01
                        • import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 Chỉ định mã hóa ký tự được sử dụng cho tên tệp được chuyển đến trình nghe. Mặc định.
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          24
                        • import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          20 cho phép đóng trình theo dõi bằng AbortSignal
                      • import * as fs from 'node:fs';const fs = require['node:fs'];
                        389. Mặc định.
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        6
                      • trả lại.
                      • Theo dõi các thay đổi trên

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12, trong đó
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12 là tệp hoặc thư mục

                        Đối số thứ hai là tùy chọn. Nếu

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 được cung cấp dưới dạng chuỗi, nó chỉ định
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        87. Mặt khác,
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 phải được chuyển thành một đối tượng

                        Cuộc gọi lại của người nghe nhận được hai đối số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        443.
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        444 là
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        23 hoặc
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        446 và
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12 là tên của tệp đã kích hoạt sự kiện

                        Trên hầu hết các nền tảng,

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        23 được phát ra bất cứ khi nào tên tệp xuất hiện hoặc biến mất trong thư mục

                        Cuộc gọi lại của người nghe được đính kèm với sự kiện

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        446 được kích hoạt bởi , nhưng nó không giống với giá trị
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        446 của
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        444

                        Nếu một

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        20 được thông qua, việc hủy bỏ AbortController tương ứng sẽ đóng kết quả trả về

                        Hãy cẩn thận

                        API

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        453 không nhất quán 100% trên các nền tảng và không khả dụng trong một số trường hợp

                        Trên Windows, sẽ không có sự kiện nào được phát ra nếu thư mục đã xem bị di chuyển hoặc đổi tên. Lỗi

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        228 được báo cáo khi thư mục đã xem bị xóa

                        khả dụng

                        Tính năng này phụ thuộc vào hệ điều hành cơ bản cung cấp cách thức được thông báo về các thay đổi của hệ thống tệp

                        • Trên các hệ thống Linux, điều này sử dụng
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          455
                        • Trên các hệ thống BSD, điều này sử dụng
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          456
                        • Trên macOS, điều này sử dụng
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          456 cho tệp và
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          458 cho thư mục
                        • Trên các hệ thống SunOS [bao gồm cả Solaris và SmartOS], điều này sử dụng
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          459
                        • Trên hệ thống Windows, tính năng này phụ thuộc vào
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          460
                        • Trên các hệ thống AIX, tính năng này phụ thuộc vào
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          461, tính năng này phải được bật
                        • Trên các hệ thống IBM i, tính năng này không được hỗ trợ

                        Nếu chức năng cơ bản không khả dụng vì lý do nào đó, thì

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        24 sẽ không thể hoạt động và có thể đưa ra một ngoại lệ. Ví dụ: việc xem tệp hoặc thư mục có thể không đáng tin cậy và trong một số trường hợp là không thể, trên hệ thống tệp mạng [NFS, SMB, v.v.] hoặc hệ thống tệp máy chủ khi sử dụng phần mềm ảo hóa như Vagrant hoặc Docker

                        Vẫn có thể sử dụng

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        393, sử dụng bỏ phiếu thống kê, nhưng phương pháp này chậm hơn và kém tin cậy hơn

                        nút

                        Trên các hệ thống Linux và macOS,

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        24 giải quyết đường dẫn đến một nút và xem nút đó. Nếu đường dẫn đã xem bị xóa và tạo lại, nó sẽ được gán một nút mới. Đồng hồ sẽ phát ra một sự kiện để xóa nhưng sẽ tiếp tục xem inode ban đầu. Các sự kiện cho inode mới sẽ không được phát ra. Đây là hành vi dự kiến

                        Các tệp AIX giữ lại cùng một inode trong suốt thời gian tồn tại của tệp. Lưu và đóng tệp đã xem trên AIX sẽ dẫn đến hai thông báo [một để thêm nội dung mới và một để cắt bớt]

                        đối số tên tệp

                        Việc cung cấp đối số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12 trong lệnh gọi lại chỉ được hỗ trợ trên Linux, macOS, Windows và AIX. Ngay cả trên các nền tảng được hỗ trợ,
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12 không phải lúc nào cũng được đảm bảo cung cấp. Do đó, đừng cho rằng đối số
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12 luôn được cung cấp trong hàm gọi lại và có một số logic dự phòng nếu nó là
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        5

                        import { unlink } from 'node:fs';
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];const { unlink } = require['node:fs'];
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];
                        9

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        469

                        Lịch sửPhiên bảnThay đổiv10. 5. 0

                        Tùy chọn

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        470 hiện được hỗ trợ

                        v7. 6. 0

                        Tham số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12 có thể là một đối tượng WHATWG
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        53 sử dụng giao thức
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        54

                        v0. 1. 31

                        Đã thêm vào. v0. 1. 31

                        Theo dõi những thay đổi trên

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        12. Cuộc gọi lại
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        389 sẽ được gọi mỗi khi tệp được truy cập

                        Đối số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 có thể được bỏ qua. Nếu được cung cấp, nó phải là một đối tượng. Đối tượng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 có thể chứa một giá trị logic có tên là
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        14 cho biết liệu quy trình có tiếp tục chạy hay không khi các tệp đang được xem. Đối tượng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 có thể chỉ định thuộc tính
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        480 cho biết tần suất mục tiêu sẽ được thăm dò tính bằng mili giây

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        389 nhận hai đối số đối tượng thống kê hiện tại và đối tượng thống kê trước đó

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        20

                        Các đối tượng thống kê này là các thể hiện của

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        482. Nếu tùy chọn
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        470 là
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        97, thì các giá trị số trong các đối tượng này được chỉ định là
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        485

                        Để được thông báo khi tệp được sửa đổi, không chỉ truy cập, cần so sánh

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        486 và
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        487

                        Khi một hoạt động của

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        488 dẫn đến lỗi
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        204, nó sẽ gọi trình nghe một lần, với tất cả các trường bằng 0 [hoặc, đối với ngày, Unix Epoch]. Nếu tệp được tạo sau này, trình nghe sẽ được gọi lại, với các đối tượng thống kê mới nhất. Đây là một thay đổi về chức năng kể từ v0. 10

                        Sử dụng hiệu quả hơn

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        488 và
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        492. Nên sử dụng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        453 thay cho
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        488 và
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        492 khi có thể

                        Khi tệp đang được xem bởi

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        393 biến mất và xuất hiện lại, thì nội dung của
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        497 trong sự kiện gọi lại thứ hai [tệp xuất hiện trở lại] sẽ giống với nội dung của
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        497 trong sự kiện gọi lại đầu tiên [sự biến mất của tệp]

                        Điều này xảy ra khi

                        • tệp bị xóa, sau đó là khôi phục
                        • tệp được đổi tên và sau đó đổi tên lần thứ hai trở lại tên ban đầu

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        499

                        Lịch sửPhiên bảnThay đổiv18. 0. 0

                        Chuyển một cuộc gọi lại không hợp lệ cho đối số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 giờ sẽ ném
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        50 thay vì
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        51

                        v14. 0. 0

                        Tham số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        28 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

                        v10. 10. 0

                        Tham số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        28 bây giờ có thể là bất kỳ
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        056 hoặc
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        057 nào

                        v10. 0. 0

                        Tham số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        83 khi chạy

                        v7. 4. 0

                        Tham số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        28 bây giờ có thể là một
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        059

                        v7. 2. 0

                        Các tham số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        29 và
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        30 hiện là tùy chọn

                        v7. 0. 0

                        Tham số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                        v0. 0. 2

                        Đã thêm vào. v0. 0. 2

                        Viết

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        28 vào tệp được chỉ định bởi
                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        064

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        29 xác định phần bộ đệm sẽ được ghi và
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        30 là số nguyên chỉ định số byte cần ghi

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        31 đề cập đến phần bù từ đầu tệp nơi dữ liệu này sẽ được ghi. Nếu
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        169, dữ liệu sẽ được ghi ở vị trí hiện tại. Xem
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        04

                        Cuộc gọi lại sẽ được cung cấp ba đối số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        521 trong đó
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        27 chỉ định có bao nhiêu byte được ghi từ
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        28

                        Nếu phương thức này được gọi dưới dạng phiên bản chỉnh sửa của nó, thì nó sẽ trả về một lời hứa cho một

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        076 với các thuộc tính
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        27 và
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        28

                        Sẽ không an toàn khi sử dụng

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        528 nhiều lần trên cùng một tệp mà không đợi gọi lại. Đối với kịch bản này, được khuyến nghị

                        Trên Linux, chức năng ghi theo vị trí không hoạt động khi tệp được mở ở chế độ chắp thêm. Hạt nhân bỏ qua đối số vị trí và luôn nối thêm dữ liệu vào cuối tệp

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        530

                        Đã thêm vào. v18. 3. 0, v16. 17. 0

                        Viết

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        28 vào tệp được chỉ định bởi
                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        064

                        Tương tự như hàm

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        533 ở trên, phiên bản này có một đối tượng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 tùy chọn. Nếu không có đối tượng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 nào được chỉ định, nó sẽ mặc định với các giá trị trên

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        536

                        Lịch sửPhiên bảnThay đổiv19. 0. 0

                        Chuyển đến tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        15 một đối tượng có chức năng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        538 riêng không còn được hỗ trợ

                        v17. 8. 0

                        Chuyển đến tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        15 một đối tượng có hàm riêng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        538 không được dùng nữa

                        v14. 12. 0

                        Tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        15 sẽ xâu chuỗi một đối tượng bằng hàm
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        538 rõ ràng

                        v14. 0. 0

                        Tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        15 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

                        v10. 0. 0

                        Tham số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        83 khi chạy

                        v7. 2. 0

                        Tham số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        31 bây giờ là tùy chọn

                        v7. 0. 0

                        Tham số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                        v0. 11. 5

                        Đã thêm vào. v0. 11. 5

                        Viết

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        15 vào tệp được chỉ định bởi
                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        064. Nếu
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        15 không phải là một chuỗi, một ngoại lệ sẽ được đưa ra

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        31 đề cập đến phần bù từ đầu tệp nơi dữ liệu này sẽ được ghi. Nếu
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        169 dữ liệu sẽ được ghi ở vị trí hiện tại. Xem
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        04

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        87 là mã hóa chuỗi dự kiến

                        Cuộc gọi lại sẽ nhận các đối số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        555 trong đó
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        556 chỉ định số lượng byte mà chuỗi đã truyền cần được ghi. Các byte được viết không nhất thiết giống như các ký tự chuỗi được viết. Nhìn thấy

                        Sẽ không an toàn khi sử dụng

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        528 nhiều lần trên cùng một tệp mà không đợi gọi lại. Đối với kịch bản này, được khuyến nghị

                        Trên Linux, chức năng ghi theo vị trí không hoạt động khi tệp được mở ở chế độ chắp thêm. Hạt nhân bỏ qua đối số vị trí và luôn nối thêm dữ liệu vào cuối tệp

                        Trên Windows, nếu bộ mô tả tệp được kết nối với bảng điều khiển [e. g.

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        560 hoặc
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        561], một chuỗi chứa các ký tự không phải ASCII sẽ không được hiển thị chính xác theo mặc định, bất kể mã hóa được sử dụng. Có thể định cấu hình bảng điều khiển để hiển thị đúng UTF-8 bằng cách thay đổi trang mã đang hoạt động bằng lệnh
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        562. Xem tài liệu chcp để biết thêm chi tiết

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        563

                        Lịch sửPhiên bảnThay đổiv19. 0. 0

                        Chuyển đến tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        15 một đối tượng có chức năng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        538 riêng không còn được hỗ trợ

                        v18. 0. 0

                        Chuyển một cuộc gọi lại không hợp lệ cho đối số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 giờ sẽ ném
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        50 thay vì
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        51

                        v17. 8. 0

                        Chuyển đến tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        15 một đối tượng có hàm riêng
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        538 không được dùng nữa

                        v16. 0. 0

                        Lỗi được trả về có thể là

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        823 nếu có nhiều hơn một lỗi được trả về

                        v15. 2. 0, v14. 17. 0

                        Đối số tùy chọn có thể bao gồm AbortSignal để hủy bỏ yêu cầu writeFile đang diễn ra

                        v14. 12. 0

                        Tham số

                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        08 sẽ xâu chuỗi một đối tượng bằng hàm
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        538 rõ ràng

                        v14. 0. 0

                        Tham số

                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        08 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

                        v10. 10. 0

                        Tham số

                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        08 bây giờ có thể là bất kỳ
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        056 hoặc một
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        057

                        v10. 0. 0

                        Tham số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 không còn là tùy chọn. Không vượt qua nó sẽ ném một
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        83 khi chạy

                        v7. 4. 0

                        Tham số

                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        08 bây giờ có thể là một
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        059

                        v7. 0. 0

                        Tham số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 không còn là tùy chọn. Không vượt qua nó sẽ phát ra cảnh báo không dùng nữa với id DEP0013

                        v5. 0. 0

                        Tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        281 hiện có thể là một bộ mô tả tệp

                        v0. 1. 29

                        Đã thêm vào. v0. 1. 29

                        Khi

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        281 là tên tệp, ghi dữ liệu không đồng bộ vào tệp, thay thế tệp nếu tệp đã tồn tại.
                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        08 có thể là một chuỗi hoặc một bộ đệm

                        Khi

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        281 là một bộ mô tả tệp, hành vi này tương tự như gọi trực tiếp
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        528 [được khuyến nghị]. Xem ghi chú bên dưới về cách sử dụng bộ mô tả tệp

                        Tùy chọn

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        87 bị bỏ qua nếu
                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        08 là bộ đệm

                        Tùy chọn

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        48 chỉ ảnh hưởng đến tệp mới tạo. Xem để biết thêm chi tiết

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        21

                        Nếu

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 là một chuỗi, thì nó chỉ định mã hóa

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        22

                        Sẽ không an toàn khi sử dụng

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        76 nhiều lần trên cùng một tệp mà không đợi gọi lại. Đối với kịch bản này, được khuyến nghị

                        Tương tự như

                        import { unlink } from 'node:fs';
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];const { unlink } = require['node:fs'];
                        
                        unlink['/tmp/hello', [err] => {
                          if [err] throw err;
                          console.log['successfully deleted /tmp/hello'];
                        }];
                        81 -
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        45 là một phương thức tiện lợi thực hiện nhiều cuộc gọi
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        41 bên trong để ghi bộ đệm được truyền cho nó. Đối với mã nhạy cảm về hiệu suất, hãy cân nhắc sử dụng

                        Có thể sử dụng an để hủy một

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        76. Việc hủy bỏ là "nỗ lực tốt nhất" và một số lượng dữ liệu có thể vẫn được ghi

                        Việc hủy bỏ một yêu cầu đang diễn ra không hủy bỏ các yêu cầu riêng lẻ của hệ điều hành mà thay vào đó, bộ đệm nội bộ

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        45 thực hiện

                        Sử dụng
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        76 với bộ mô tả tệp

                        Khi

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        281 là một bộ mô tả tệp, hành vi này gần giống với việc gọi trực tiếp
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        528 như

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        23

                        Sự khác biệt so với việc gọi trực tiếp

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        528 là trong một số điều kiện bất thường,
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        528 có thể chỉ ghi một phần của bộ đệm và cần được thử lại để ghi phần dữ liệu còn lại, trong khi đó,
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        76 sẽ thử lại cho đến khi dữ liệu được ghi hoàn toàn [hoặc xảy ra lỗi]

                        Ý nghĩa của điều này là một nguồn nhầm lẫn phổ biến. Trong trường hợp mô tả tệp, tệp không được thay thế. Dữ liệu không nhất thiết phải được ghi vào đầu tệp và dữ liệu gốc của tệp có thể vẫn ở trước và/hoặc sau dữ liệu mới được ghi

                        Ví dụ: nếu

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        76 được gọi hai lần liên tiếp, trước tiên hãy viết chuỗi
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        608, sau đó viết chuỗi
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        609, tệp sẽ chứa
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        610 và có thể chứa một số dữ liệu gốc của tệp [tùy thuộc vào kích thước của tệp gốc . Nếu một tên tệp đã được sử dụng thay vì một bộ mô tả, tệp sẽ được đảm bảo chỉ chứa
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        609

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        612

                        Lịch sửPhiên bảnThay đổiv18. 0. 0

                        Chuyển một cuộc gọi lại không hợp lệ cho đối số

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        49 giờ sẽ ném
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        50 thay vì
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        51

                        v12. 9. 0

                        Đã thêm vào. v12. 9. 0

                        Viết một mảng gồm các

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        166 vào tệp được chỉ định bởi
                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        064 bằng cách sử dụng
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        45

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        31 là phần bù từ đầu tệp nơi dữ liệu này sẽ được ghi. Nếu
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        169, dữ liệu sẽ được ghi ở vị trí hiện tại

                        Cuộc gọi lại sẽ được đưa ra ba đối số.

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        746,
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        27 và
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        74.
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        27 là bao nhiêu byte được viết từ
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        74

                        Nếu phương thức này là ed, nó sẽ trả về một lời hứa cho một

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        076 với các thuộc tính
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        27 và
                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        74

                        Sẽ không an toàn khi sử dụng

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        630 nhiều lần trên cùng một tệp mà không đợi gọi lại. Đối với kịch bản này, sử dụng

                        Trên Linux, chức năng ghi theo vị trí không hoạt động khi tệp được mở ở chế độ chắp thêm. Hạt nhân bỏ qua đối số vị trí và luôn nối thêm dữ liệu vào cuối tệp

                        API đồng bộ

                        Các API đồng bộ thực hiện tất cả các hoạt động một cách đồng bộ, chặn vòng lặp sự kiện cho đến khi hoạt động hoàn thành hoặc không thành công

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        632

                        Lịch sửPhiên bảnChangesv7. 6. 0

                        Tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        47 có thể là một đối tượng WHATWG
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        53 sử dụng giao thức
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        54

                        v0. 11. 15

                        Đã thêm vào. v0. 11. 15

                        Kiểm tra đồng bộ quyền của người dùng đối với tệp hoặc thư mục được chỉ định bởi

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        47. Đối số
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        48 là một số nguyên tùy chọn chỉ định kiểm tra khả năng truy cập sẽ được thực hiện.
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        48 phải là giá trị
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        50 hoặc mặt nạ bao gồm bitwise OR của bất kỳ giá trị nào trong số
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        51,
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        52 và
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        53 [e. g.
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        54]. Kiểm tra các giá trị có thể có của
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        48

                        Nếu bất kỳ kiểm tra khả năng truy cập nào không thành công, một

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        10 sẽ bị ném. Nếu không, phương thức sẽ trả về
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        6

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        24

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        647

                        Lịch sửPhiên bảnChangesv7. 0. 0

                        Đối tượng

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 đã qua sẽ không bao giờ được sửa đổi

                        v5. 0. 0

                        Tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        281 hiện có thể là một bộ mô tả tệp

                        v0. 6. 7

                        Đã thêm vào. v0. 6. 7

                        Đồng bộ thêm dữ liệu vào một tệp, tạo tệp nếu nó chưa tồn tại.

                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        08 có thể là một chuỗi hoặc một

                        Tùy chọn

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        48 chỉ ảnh hưởng đến tệp mới tạo. Xem để biết thêm chi tiết

                        Nếu

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        78 là một chuỗi, thì nó chỉ định mã hóa

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        25

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        47 có thể được chỉ định làm bộ mô tả tệp số đã được mở để nối thêm [sử dụng
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        64 hoặc
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        93]. Bộ mô tả tệp sẽ không được đóng tự động

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        657

                        Lịch sửPhiên bảnChangesv7. 6. 0

                        Tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        47 có thể là một đối tượng WHATWG
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        53 sử dụng giao thức
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        54

                        v0. 6. 7

                        Đã thêm vào. v0. 6. 7

                        Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                        Xem tài liệu POSIX

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        07 để biết thêm chi tiết

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        663

                        Lịch sửPhiên bảnChangesv7. 6. 0

                        Tham số

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        47 có thể là một đối tượng WHATWG
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        53 sử dụng giao thức
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        54

                        v0. 1. 97

                        Đã thêm vào. v0. 1. 97

                        Đồng bộ thay đổi chủ sở hữu và nhóm của một tập tin. Trả lại

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        6. Đây là phiên bản đồng bộ của

                        Xem tài liệu POSIX

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        72 để biết thêm chi tiết

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        670

                        Đóng bộ mô tả tập tin. Trả lại

                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        6

                        Gọi

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        672 trên bất kỳ bộ mô tả tệp nào [
                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        064] hiện đang được sử dụng thông qua bất kỳ hoạt động
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        56 nào khác có thể dẫn đến hành vi không xác định

                        Xem tài liệu POSIX

                        import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                        066 để biết thêm chi tiết

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        676

                        Lịch sửPhiên bảnChangesv14. 0. 0

                        Đã thay đổi đối số

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        10 thành
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        48 và áp đặt xác thực loại nghiêm ngặt hơn

                        v8. 5. 0

                        Đã thêm vào. v8. 5. 0

                        Sao chép đồng bộ

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        72 sang
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        73. Theo mặc định,
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        73 được ghi đè nếu nó đã tồn tại. Trả lại
                        import { open } from 'node:fs/promises';
                        
                        const fd = await open['sample.txt'];
                        fd.createReadStream[{ start: 90, end: 99 }];
                        6. Nút. js không đảm bảo về tính nguyên tử của thao tác sao chép. Nếu xảy ra lỗi sau khi tệp đích đã được mở để ghi, Nút. js sẽ cố gắng xóa đích

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        48 là một số nguyên tùy chọn chỉ định hành vi của thao tác sao chép. Có thể tạo một mặt nạ bao gồm OR theo bit của hai hoặc nhiều giá trị [e. g.
                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        75]

                        • import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          77. Thao tác sao chép sẽ thất bại nếu
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          73 đã tồn tại
                        • import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          79. Thao tác sao chép sẽ cố gắng tạo liên kết giới thiệu sao chép khi ghi. Nếu nền tảng không hỗ trợ sao chép khi ghi, thì cơ chế sao chép dự phòng sẽ được sử dụng
                        • import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          80. Thao tác sao chép sẽ cố gắng tạo liên kết giới thiệu sao chép khi ghi. Nếu nền tảng không hỗ trợ sao chép khi ghi, thì thao tác sẽ không thành công

                        import * as fs from 'node:fs';const fs = require['node:fs'];
                        689

                        Lịch sửPhiên bảnThay đổiv17. 6. 0, v16. 15. 0

                        Chấp nhận tùy chọn

                        import { unlink } from 'node:fs/promises';
                        
                        try {
                          await unlink['/tmp/hello'];
                          console.log['successfully deleted /tmp/hello'];
                        } catch [error] {
                          console.error['there was an error:', error.message];
                        }const { unlink } = require['node:fs/promises'];
                        
                        [async function[path] {
                          try {
                            await unlink[path];
                            console.log[`successfully deleted ${path}`];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }
                        }]['/tmp/hello'];
                        86 bổ sung để chỉ định có thực hiện phân giải đường dẫn cho liên kết tượng trưng hay không

                        v16. 7. 0

                        Đã thêm vào. v16. 7. 0

                        • import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          72. đường dẫn nguồn để sao chép
                        • import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          73. đường dẫn đích để sao chép vào
                        • import * as fs from 'node:fs';const fs = require['node:fs'];
                          78
                          • import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            90 liên kết tượng trưng dereference. Mặc định.
                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            01
                          • import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            92 khi
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            93 là
                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            01 và đích tồn tại, đưa ra lỗi. Mặc định.
                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            01
                          • import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            96 Chức năng lọc tập tin/thư mục sao chép. Trả lại
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            97 để sao chép mục này,
                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            01 để bỏ qua nó. Mặc định.
                            import { open } from 'node:fs/promises';
                            
                            const fd = await open['sample.txt'];
                            fd.createReadStream[{ start: 90, end: 99 }];
                            6
                          • import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            93 ghi đè lên tệp hoặc thư mục hiện có. Thao tác sao chép sẽ bỏ qua lỗi nếu bạn đặt giá trị này thành false và đích tồn tại. Sử dụng tùy chọn
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            92 để thay đổi hành vi này. Mặc định.
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            97
                          • import { unlink } from 'node:fs';
                            
                            unlink['/tmp/hello', [err] => {
                              if [err] throw err;
                              console.log['successfully deleted /tmp/hello'];
                            }];const { unlink } = require['node:fs'];
                            
                            unlink['/tmp/hello', [err] => {
                              if [err] throw err;
                              console.log['successfully deleted /tmp/hello'];
                            }];
                            06 Khi dấu thời gian của
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            97 từ
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            72 sẽ được giữ nguyên. Mặc định.
                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            01
                          • import { unlink } from 'node:fs';
                            
                            unlink['/tmp/hello', [err] => {
                              if [err] throw err;
                              console.log['successfully deleted /tmp/hello'];
                            }];const { unlink } = require['node:fs'];
                            
                            unlink['/tmp/hello', [err] => {
                              if [err] throw err;
                              console.log['successfully deleted /tmp/hello'];
                            }];
                            10 sao chép thư mục theo cách đệ quy Mặc định.
                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            01
                          • import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            86 Khi
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            97, độ phân giải đường dẫn cho các liên kết tượng trưng sẽ bị bỏ qua. Mặc định.
                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            01

                          Sao chép đồng bộ toàn bộ cấu trúc thư mục từ

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          72 đến
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          73, bao gồm các thư mục con và tệp

                          Khi sao chép một thư mục sang một thư mục khác, khối cầu không được hỗ trợ và hành vi tương tự như

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          18

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          719

                          Lịch sửPhiên bảnChangesv7. 6. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v0. 1. 21

                          Đã thêm vào. v0. 1. 21

                          Trả về

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          97 nếu đường dẫn tồn tại, ngược lại là
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          01

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          747 không được dùng nữa, nhưng
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          727 thì không. Tham số
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          49 đến
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          747 chấp nhận các tham số không nhất quán với các Nút khác. gọi lại js.
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          727 không sử dụng gọi lại

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          26

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          731

                          Đặt quyền trên tệp. Trả lại

                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          Xem tài liệu POSIX

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          761 để biết thêm chi tiết

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          734

                          Đặt chủ sở hữu của tập tin. Trả lại

                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          Xem tài liệu POSIX

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          769 để biết thêm chi tiết

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          737

                          Buộc tất cả các hoạt động I/O được xếp hàng hiện tại được liên kết với tệp về trạng thái hoàn thành I/O được đồng bộ hóa của hệ điều hành. Tham khảo tài liệu POSIX

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          24 để biết chi tiết. Trả lại
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          740

                          Lịch sửPhiên bảnThay đổiv10. 5. 0

                          Chấp nhận một đối tượng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

                          v0. 1. 95

                          Đã thêm vào. v0. 1. 95

                          Truy xuất bộ mô tả tập tin

                          Xem tài liệu POSIX

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          786 để biết thêm chi tiết

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          743

                          Yêu cầu tất cả dữ liệu cho bộ mô tả tệp mở được chuyển sang thiết bị lưu trữ. Việc triển khai cụ thể là hệ điều hành và thiết bị cụ thể. Tham khảo tài liệu POSIX

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          83 để biết thêm chi tiết. Trả lại
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          746

                          Cắt bớt bộ mô tả tập tin. Trả lại

                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          749

                          Lịch sửPhiên bảnChangesv4. 1. 0

                          Các chuỗi số,

                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          07 và
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          08 hiện được phép xác định thời gian

                          v0. 4. 2

                          Đã thêm vào. v0. 4. 2

                          Phiên bản đồng bộ của. Trả lại

                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          754

                          Thay đổi quyền trên một liên kết tượng trưng. Trả lại

                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          Phương pháp này chỉ được thực hiện trên macOS

                          Xem tài liệu POSIX

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          827 để biết thêm chi tiết

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          757

                          Lịch sửPhiên bảnChangesv10. 6. 0

                          API này không còn được dùng nữa

                          v0. 4. 7

                          Ngừng sử dụng tài liệu chỉ

                          Đặt chủ sở hữu cho đường dẫn. Trả lại

                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          Xem tài liệu POSIX

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          835 để biết thêm chi tiết

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          760

                          Đã thêm vào. v14. 5. 0, v12. 19. 0

                          Thay đổi dấu thời gian hệ thống tệp của liên kết tượng trưng được tham chiếu bởi

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47. Trả về
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6 hoặc đưa ra một ngoại lệ khi tham số không chính xác hoặc thao tác không thành công. Đây là phiên bản đồng bộ của

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          764

                          Lịch sửPhiên bảnChangesv7. 6. 0

                          Các tham số

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          24 và
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          25 có thể là các đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54. Hỗ trợ hiện vẫn đang thử nghiệm

                          v0. 1. 31

                          Đã thêm vào. v0. 1. 31

                          Tạo một liên kết mới từ ________ 624 đến ________ 625. Xem tài liệu POSIX

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          26 để biết thêm chi tiết. Trả lại
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          773

                          Lịch sửPhiên bảnThay đổiv15. 3. 0, v14. 17. 0

                          Chấp nhận tùy chọn

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          774 để chỉ định có nên ném ngoại lệ hay không nếu mục nhập không tồn tại

                          v10. 5. 0

                          Chấp nhận một đối tượng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

                          v7. 6. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v0. 1. 30

                          Đã thêm vào. v0. 1. 30

                          Truy xuất liên kết tượng trưng được gọi bởi

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47

                          Xem tài liệu POSIX

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          31 để biết thêm chi tiết

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          781

                          Lịch sửPhiên bảnThay đổiv13. 11. 0, v12. 17. 0

                          Ở chế độ

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          10, đường dẫn được tạo đầu tiên được trả về ngay bây giờ

                          v10. 12. 0

                          Đối số thứ hai bây giờ có thể là một đối tượng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 với các thuộc tính
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          10 và
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          48

                          v7. 6. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v0. 1. 21

                          Đã thêm vào. v0. 1. 21

                          Đồng bộ tạo một thư mục. Trả về

                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6 hoặc nếu
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          10 là
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          97, đường dẫn thư mục đầu tiên được tạo. Đây là phiên bản đồng bộ của

                          Xem tài liệu POSIX

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          001 để biết thêm chi tiết

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          794

                          Lịch sửPhiên bảnThay đổiv16. 5. 0, v14. 18. 0

                          Tham số

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          41 hiện chấp nhận một chuỗi rỗng

                          v5. 10. 0

                          Đã thêm vào. v5. 10. 0

                          Trả về đường dẫn thư mục đã tạo

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          Đối số

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 tùy chọn có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 chỉ định mã hóa ký tự sẽ sử dụng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          799

                          Lịch sửPhiên bảnThay đổiv13. 1. 0, v12. 16. 0

                          Tùy chọn

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          61 đã được giới thiệu

                          v12. 12. 0

                          Đã thêm vào. v12. 12. 0

                          Đồng bộ mở một thư mục. Xem

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          62

                          Tạo một , chứa tất cả các chức năng khác để đọc và dọn dẹp thư mục

                          Tùy chọn

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 đặt mã hóa cho
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 trong khi mở thư mục và các thao tác đọc tiếp theo

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          804

                          Lịch sửPhiên bảnChangesv11. 1. 0

                          Đối số

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          10 hiện là tùy chọn và mặc định là
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          57

                          v9. 9. 0

                          Các cờ ________ 2030 và ________ 2031 hiện được hỗ trợ

                          v7. 6. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v0. 1. 21

                          Đã thêm vào. v0. 1. 21

                          Trả về một số nguyên đại diện cho bộ mô tả tệp

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          813

                          Lịch sửPhiên bảnChangesv10. 10. 0

                          Tùy chọn mới

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          66 đã được thêm vào

                          v7. 6. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v0. 1. 21

                          Đã thêm vào. v0. 1. 21

                          Đọc nội dung của thư mục

                          Xem tài liệu POSIX

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          103 để biết thêm chi tiết

                          Đối số

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 tùy chọn có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 chỉ định mã hóa ký tự sẽ sử dụng cho tên tệp được trả về. Nếu
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 được đặt thành
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          70, tên tệp được trả về sẽ được chuyển dưới dạng đối tượng

                          Nếu

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          71 được đặt thành
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          97, kết quả sẽ chứa các đối tượng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          825

                          Lịch sửPhiên bảnChangesv7. 6. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v5. 0. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 hiện có thể là một bộ mô tả tệp

                          v0. 1. 8

                          Đã thêm vào. v0. 1. 8

                          Trả về nội dung của

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          Nếu tùy chọn

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 được chỉ định thì hàm này trả về một chuỗi. Nếu không, nó trả về một bộ đệm

                          Tương tự như , khi đường dẫn là một thư mục, hành vi của

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          130 là dành riêng cho nền tảng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          835

                          Lịch sửPhiên bảnChangesv7. 6. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v0. 1. 31

                          Đã thêm vào. v0. 1. 31

                          Trả về giá trị chuỗi của liên kết tượng trưng

                          Xem tài liệu POSIX

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          84 để biết thêm chi tiết

                          Đối số tùy chọn

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 chỉ định mã hóa ký tự sẽ sử dụng cho đường dẫn liên kết được trả về. Nếu
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 được đặt thành
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          70, đường dẫn liên kết được trả về sẽ được chuyển dưới dạng đối tượng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          844

                          Lịch sửPhiên bảnChangesv10. 10. 0

                          Tham số

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          28 bây giờ có thể là bất kỳ
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          056 hoặc
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          057 nào

                          v6. 0. 0

                          Tham số

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          30 bây giờ có thể là
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          39

                          v0. 1. 21

                          Đã thêm vào. v0. 1. 21

                          Trả về số của

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          077

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          852

                          Lịch sửPhiên bảnThay đổiv13. 13. 0, v12. 17. 0

                          Đã thêm vào. v13. 13. 0, v12. 17. 0

                          v13. 13. 0, v12. 17. 0

                          Đối tượng tùy chọn có thể được chuyển vào để tạo độ lệch, độ dài và vị trí tùy chọn

                          Trả về số của

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          077

                          Tương tự như hàm

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          854 ở trên, phiên bản này có một đối tượng
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 tùy chọn. Nếu không có đối tượng
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 nào được chỉ định, nó sẽ mặc định với các giá trị trên

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          858

                          Đã thêm vào. v13. 13. 0, v12. 17. 0

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          860

                          Lịch sửPhiên bảnChangesv8. 0. 0

                          Hỗ trợ giải quyết đường ống/ổ cắm đã được thêm vào

                          v7. 6. 0

                          Tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v6. 4. 0

                          Gọi

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          864 hiện đã hoạt động trở lại đối với các trường hợp cạnh khác nhau trên Windows

                          v6. 0. 0

                          Tham số

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          189 đã bị xóa

                          v0. 1. 31

                          Đã thêm vào. v0. 1. 31

                          Trả về tên đường dẫn đã giải quyết

                          Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          867

                          Đồng bộ

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          192

                          Chỉ hỗ trợ các đường dẫn có thể chuyển đổi thành chuỗi UTF8

                          Đối số tùy chọn

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          78 có thể là một chuỗi chỉ định mã hóa hoặc đối tượng có thuộc tính
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 chỉ định mã hóa ký tự sẽ sử dụng cho đường dẫn được trả về. Nếu
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          87 được đặt thành
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          70, đường dẫn được trả về sẽ được truyền dưới dạng đối tượng

                          Trên Linux, khi nút. js được liên kết với musl libc, hệ thống tệp procfs phải được gắn trên

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          97 để chức năng này hoạt động. Glibc không có hạn chế này

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          874

                          Lịch sửPhiên bảnChangesv7. 6. 0

                          Các tham số

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          99 và
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          25 có thể là các đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54. Hỗ trợ hiện vẫn đang thử nghiệm

                          v0. 1. 21

                          Đã thêm vào. v0. 1. 21

                          Đổi tên tệp từ

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          99 thành
                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          25. Trả lại
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          6

                          Xem tài liệu POSIX

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          229 để biết thêm chi tiết

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          883

                          Lịch sửPhiên bảnThay đổiv16. 0. 0

                          Sử dụng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          884 trên một tệp
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 không còn được phép và dẫn đến lỗi
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          204 trên Windows và lỗi
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          205 trên POSIX

                          v16. 0. 0

                          Việc sử dụng

                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          884 trên một
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 không tồn tại sẽ không còn được phép và dẫn đến lỗi
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          204

                          v16. 0. 0

                          Tùy chọn

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          10 không được dùng nữa, sử dụng tùy chọn này sẽ kích hoạt cảnh báo không dùng nữa

                          v14. 14. 0

                          Tùy chọn

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          10 không được dùng nữa, thay vào đó hãy sử dụng
                          import * as fs from 'node:fs';const fs = require['node:fs'];
                          893

                          v13. 3. 0, v12. 16. 0

                          Tùy chọn

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          212 được đổi tên thành
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          213 và giá trị mặc định là 0. Tùy chọn
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          214 đã bị xóa và các lỗi
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          215 sử dụng logic thử lại giống như các lỗi khác. Tùy chọn
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          216 hiện được hỗ trợ. Lỗi
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          217 hiện đã được thử lại

                          v12. 10. 0

                          Các tùy chọn

                          import { unlink } from 'node:fs';
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];const { unlink } = require['node:fs'];
                          
                          unlink['/tmp/hello', [err] => {
                            if [err] throw err;
                            console.log['successfully deleted /tmp/hello'];
                          }];
                          10,
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          212 và
                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          214 hiện đã được hỗ trợ

                          v7. 6. 0

                          Các tham số

                          import { unlink } from 'node:fs/promises';
                          
                          try {
                            await unlink['/tmp/hello'];
                            console.log['successfully deleted /tmp/hello'];
                          } catch [error] {
                            console.error['there was an error:', error.message];
                          }const { unlink } = require['node:fs/promises'];
                          
                          [async function[path] {
                            try {
                              await unlink[path];
                              console.log[`successfully deleted ${path}`];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }
                          }]['/tmp/hello'];
                          47 có thể là một đối tượng WHATWG
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          53 sử dụng giao thức
                          import { open } from 'node:fs/promises';
                          
                          const fd = await open['sample.txt'];
                          fd.createReadStream[{ start: 90, end: 99 }];
                          54

                          v0. 1. 21

                          Đã thêm vào. v0. 1. 21

                          • import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            47. .
                          • import * as fs from 'node:fs';const fs = require['node:fs'];
                            78
                            • import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              213 Nếu gặp lỗi
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              224,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              215,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              217,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              227 hoặc
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              228, Nút. js thử lại thao tác với thời gian chờ dự phòng tuyến tính dài hơn
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              216 mili giây cho mỗi lần thử. Tùy chọn này đại diện cho số lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                              import { unlink } from 'node:fs';
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];const { unlink } = require['node:fs'];
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];
                              10 không phải là
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97. Mặc định.
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              39
                            • import { unlink } from 'node:fs';
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];const { unlink } = require['node:fs'];
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];
                              10 Nếu
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97, thực hiện xóa thư mục đệ quy. Trong chế độ đệ quy, các hoạt động được thử lại khi thất bại. Mặc định.
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              01. không dùng nữa
                            • import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              216 Lượng thời gian tính bằng mili giây để chờ giữa các lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                              import { unlink } from 'node:fs';
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];const { unlink } = require['node:fs'];
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];
                              10 không phải là
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97. Mặc định.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              239

                            Đồng bộ

                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            279. Trả lại
                            import { open } from 'node:fs/promises';
                            
                            const fd = await open['sample.txt'];
                            fd.createReadStream[{ start: 90, end: 99 }];
                            6

                            Sử dụng

                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            927 trên tệp [không phải thư mục] dẫn đến lỗi
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            204 trên Windows và lỗi
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            205 trên POSIX

                            Để có hành vi tương tự như lệnh

                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            245 Unix, hãy sử dụng với các tùy chọn
                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            247

                            import * as fs from 'node:fs';const fs = require['node:fs'];
                            933

                            Lịch sửPhiên bảnThay đổiv17. 3. 0, v16. 14. 0

                            Tham số

                            import { unlink } from 'node:fs/promises';
                            
                            try {
                              await unlink['/tmp/hello'];
                              console.log['successfully deleted /tmp/hello'];
                            } catch [error] {
                              console.error['there was an error:', error.message];
                            }const { unlink } = require['node:fs/promises'];
                            
                            [async function[path] {
                              try {
                                await unlink[path];
                                console.log[`successfully deleted ${path}`];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }
                            }]['/tmp/hello'];
                            47 có thể là một đối tượng WHATWG
                            import { open } from 'node:fs/promises';
                            
                            const fd = await open['sample.txt'];
                            fd.createReadStream[{ start: 90, end: 99 }];
                            53 sử dụng giao thức
                            import { open } from 'node:fs/promises';
                            
                            const fd = await open['sample.txt'];
                            fd.createReadStream[{ start: 90, end: 99 }];
                            54

                            v14. 14. 0

                            Đã thêm vào. v14. 14. 0

                            • import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47. .
                            • import * as fs from 'node:fs';const fs = require['node:fs'];
                              78
                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                93 Khi
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                97, các ngoại lệ sẽ bị bỏ qua nếu
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                47 không tồn tại. Mặc định.
                                import * as fs from 'node:fs';const fs = require['node:fs'];
                                01
                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                213 Nếu gặp lỗi
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                224,
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                215,
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                217,
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                227 hoặc
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                228, Nút. js sẽ thử lại thao tác với thời gian chờ tắt tuyến tính dài hơn
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                216 mili giây cho mỗi lần thử. Tùy chọn này đại diện cho số lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                                import { unlink } from 'node:fs';
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];const { unlink } = require['node:fs'];
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];
                                10 không phải là
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                97. Mặc định.
                                import * as fs from 'node:fs';const fs = require['node:fs'];
                                39
                              • import { unlink } from 'node:fs';
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];const { unlink } = require['node:fs'];
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];
                                10 Nếu
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                97, thực hiện xóa thư mục đệ quy. Trong chế độ đệ quy, các hoạt động được thử lại khi thất bại. Mặc định.
                                import * as fs from 'node:fs';const fs = require['node:fs'];
                                01
                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                216 Lượng thời gian tính bằng mili giây để chờ giữa các lần thử lại. Tùy chọn này bị bỏ qua nếu tùy chọn
                                import { unlink } from 'node:fs';
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];const { unlink } = require['node:fs'];
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];
                                10 không phải là
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                97. Mặc định.
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                239

                              Xóa đồng bộ các tệp và thư mục [được mô hình hóa trên tiện ích POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              273 tiêu chuẩn]. Trả lại
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              6

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              962

                              Lịch sửPhiên bảnThay đổiv15. 3. 0, v14. 17. 0

                              Chấp nhận tùy chọn

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              774 để chỉ định có nên ném ngoại lệ hay không nếu mục nhập không tồn tại

                              v10. 5. 0

                              Chấp nhận một đối tượng

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              78 bổ sung để chỉ định xem các giá trị số được trả về có phải là bigint hay không

                              v7. 6. 0

                              Tham số

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 có thể là một đối tượng WHATWG
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              53 sử dụng giao thức
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54

                              v0. 1. 21

                              Đã thêm vào. v0. 1. 21

                              Truy xuất đường dẫn

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              968

                              Lịch sửPhiên bảnChangesv12. 0. 0

                              Nếu đối số

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              277 không được xác định, Node sẽ tự động phát hiện loại
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              279 và tự động chọn
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              280 hoặc
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              281

                              v7. 6. 0

                              Các tham số

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              279 và
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 có thể là các đối tượng WHATWG
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              53 sử dụng giao thức
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54. Hỗ trợ hiện vẫn đang thử nghiệm

                              v0. 1. 31

                              Đã thêm vào. v0. 1. 31

                              Trả lại

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              6

                              Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              979

                              Cắt bớt tập tin. Trả lại

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              6. Một bộ mô tả tệp cũng có thể được chuyển làm đối số đầu tiên. Trong trường hợp này,
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              981 được gọi là

                              Truyền một bộ mô tả tệp không được dùng nữa và có thể dẫn đến lỗi trong tương lai

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              982

                              Lịch sửPhiên bảnChangesv7. 6. 0

                              Tham số

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 có thể là một đối tượng WHATWG
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              53 sử dụng giao thức
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54

                              v0. 1. 21

                              Đã thêm vào. v0. 1. 21

                              Đồng bộ

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              00. Trả lại
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              6

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              988

                              Lịch sửPhiên bảnChangesv8. 0. 0

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              07,
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              08, và
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              09 không còn là bộ chỉ định thời gian hợp lệ

                              v7. 6. 0

                              Tham số

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 có thể là một đối tượng WHATWG
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              53 sử dụng giao thức
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54

                              v4. 1. 0

                              Các chuỗi số,

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              07 và
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              08 hiện được phép xác định thời gian

                              v0. 4. 2

                              Đã thêm vào. v0. 4. 2

                              Trả lại

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              6

                              Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              999

                              Lịch sửPhiên bảnThay đổiv19. 0. 0

                              Chuyển đến tham số

                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              08 một đối tượng có chức năng
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              538 riêng không còn được hỗ trợ

                              v17. 8. 0

                              Chuyển đến tham số

                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              08 một đối tượng có hàm riêng
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              538 không được dùng nữa

                              v14. 12. 0

                              Tham số

                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              08 sẽ xâu chuỗi một đối tượng bằng hàm
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              538 rõ ràng

                              v14. 0. 0

                              Tham số

                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              08 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

                              v10. 10. 0

                              Tham số

                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              08 bây giờ có thể là bất kỳ
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              056 hoặc một
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              057

                              v7. 4. 0

                              Tham số

                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              08 bây giờ có thể là một
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              059

                              v5. 0. 0

                              Tham số

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              281 hiện có thể là một bộ mô tả tệp

                              v0. 1. 29

                              Đã thêm vào. v0. 1. 29

                              Trả lại

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              6

                              Tùy chọn

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              48 chỉ ảnh hưởng đến tệp mới tạo. Xem để biết thêm chi tiết

                              Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              017

                              Lịch sửPhiên bảnChangesv14. 0. 0

                              Tham số

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              28 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

                              v10. 10. 0

                              Tham số

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              28 bây giờ có thể là bất kỳ
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              056 hoặc
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              057 nào

                              v7. 4. 0

                              Tham số

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              28 bây giờ có thể là một
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              059

                              v7. 2. 0

                              Các tham số

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              29 và
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              30 hiện là tùy chọn

                              v0. 1. 21

                              Đã thêm vào. v0. 1. 21

                              Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              027

                              Đã thêm vào. v18. 3. 0, v16. 17. 0

                              Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              029

                              Lịch sửPhiên bảnChangesv14. 0. 0

                              Tham số

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              15 sẽ không ép buộc đầu vào không được hỗ trợ vào chuỗi nữa

                              v7. 2. 0

                              Tham số

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              31 bây giờ là tùy chọn

                              v0. 11. 5

                              Đã thêm vào. v0. 11. 5

                              Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              033

                              Để biết thông tin chi tiết, hãy xem tài liệu về phiên bản không đồng bộ của API này.

                              Những vật thông thường

                              Các đối tượng chung được chia sẻ bởi tất cả các biến thể API hệ thống tệp [lời hứa, gọi lại và đồng bộ]

                              Lớp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              035

                              Một lớp đại diện cho một luồng thư mục

                              Được tạo bởi , , hoặc

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              2

                              Khi sử dụng async iterator, đối tượng sẽ tự động đóng sau khi iterator thoát

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              039

                              Đóng xử lý tài nguyên cơ bản của thư mục một cách không đồng bộ. Các lần đọc tiếp theo sẽ dẫn đến lỗi

                              Một lời hứa được trả lại sẽ được giải quyết sau khi tài nguyên đã bị đóng

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              040

                              Lịch sửPhiên bảnThay đổiv18. 0. 0

                              Chuyển một cuộc gọi lại không hợp lệ cho đối số

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              49 giờ sẽ ném
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              50 thay vì
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              51

                              v12. 12. 0

                              Đã thêm vào. v12. 12. 0

                              Đóng xử lý tài nguyên cơ bản của thư mục một cách không đồng bộ. Các lần đọc tiếp theo sẽ dẫn đến lỗi

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              49 sẽ được gọi sau khi xử lý tài nguyên đã bị đóng

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              045

                              Đóng đồng bộ xử lý tài nguyên cơ bản của thư mục. Các lần đọc tiếp theo sẽ dẫn đến lỗi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              046

                              Đường dẫn chỉ đọc của thư mục này như được cung cấp cho , , hoặc

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              050

                              Đọc không đồng bộ mục nhập thư mục tiếp theo qua

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              103 dưới dạng

                              Một lời hứa được trả lại sẽ được giải quyết bằng , hoặc

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              5 nếu không còn mục nhập thư mục nào để đọc

                              Các mục nhập thư mục được hàm này trả về không theo thứ tự cụ thể như được cung cấp bởi các cơ chế thư mục cơ bản của hệ điều hành. Các mục được thêm hoặc xóa trong khi lặp qua thư mục có thể không được đưa vào kết quả lặp

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              053

                              Đọc không đồng bộ mục nhập thư mục tiếp theo qua

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              103 dưới dạng

                              Sau khi đọc xong,

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              49 sẽ được gọi với dấu , hoặc
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              5 nếu không còn mục nhập thư mục nào để đọc

                              Các mục nhập thư mục được hàm này trả về không theo thứ tự cụ thể như được cung cấp bởi các cơ chế thư mục cơ bản của hệ điều hành. Các mục được thêm hoặc xóa trong khi lặp qua thư mục có thể không được đưa vào kết quả lặp

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              057

                              Đọc đồng bộ mục nhập thư mục tiếp theo dưới dạng. Xem tài liệu POSIX

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              103 để biết thêm chi tiết

                              Nếu không còn mục nào trong thư mục để đọc, thì sẽ trả về

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              5

                              Các mục nhập thư mục được hàm này trả về không theo thứ tự cụ thể như được cung cấp bởi các cơ chế thư mục cơ bản của hệ điều hành. Các mục được thêm hoặc xóa trong khi lặp qua thư mục có thể không được đưa vào kết quả lặp

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              060

                              Lặp lại không đồng bộ trên thư mục cho đến khi tất cả các mục đã được đọc. Tham khảo tài liệu POSIX

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              103 để biết thêm chi tiết

                              Các mục được trả về bởi trình vòng lặp không đồng bộ luôn là một. Trường hợp

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              5 từ
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              050 được xử lý nội bộ

                              Xem ví dụ

                              Các mục nhập thư mục được trình vòng lặp này trả về không theo thứ tự cụ thể như được cung cấp bởi các cơ chế thư mục cơ bản của hệ điều hành. Các mục được thêm hoặc xóa trong khi lặp qua thư mục có thể không được đưa vào kết quả lặp

                              Lớp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              064

                              Một đại diện của một mục nhập thư mục, có thể là một tệp hoặc thư mục con trong thư mục, được trả về bằng cách đọc từ một. Mục nhập thư mục là sự kết hợp của các cặp tên tệp và loại tệp

                              Ngoài ra, khi or được gọi với tùy chọn

                              import { unlink } from 'node:fs';
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];const { unlink } = require['node:fs'];
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];
                              66 được đặt thành
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97, mảng kết quả được lấp đầy bằng các đối tượng, thay vì các chuỗi hoặc s

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              069

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một thiết bị khối

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              071

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một thiết bị ký tự

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              073

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả thư mục hệ thống tệp

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              075

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả ống nhập trước xuất trước [FIFO]

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              077

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một tệp thông thường

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              079

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một ổ cắm

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              081

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một liên kết tượng trưng

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              083

                              Tên tệp mà đối tượng này đề cập đến. Loại giá trị này được xác định bởi

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              65 được chuyển đến hoặc

                              Lớp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              087

                              Gọi phương thức thành công sẽ trả về một đối tượng mới

                              Tất cả các đối tượng phát ra sự kiện

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              446 bất cứ khi nào một tệp đã xem cụ thể được sửa đổi

                              Biến cố.
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              446
                              • import * as fs from 'node:fs';const fs = require['node:fs'];
                                444 Loại sự kiện thay đổi đã xảy ra
                              • import { open } from 'node:fs/promises';
                                
                                const fd = await open['sample.txt'];
                                fd.createReadStream[{ start: 90, end: 99 }];
                                12. Tên tệp đã thay đổi [nếu có/có liên quan]

                              Phát ra khi có gì đó thay đổi trong thư mục hoặc tệp đã xem. Xem thêm chi tiết tại

                              Đối số

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              12 có thể không được cung cấp tùy thuộc vào sự hỗ trợ của hệ điều hành. Nếu cung cấp
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              12, nó sẽ được cung cấp dưới dạng nếu
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              24 được gọi với tùy chọn
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              87 được đặt thành
                              import { unlink } from 'node:fs';
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];const { unlink } = require['node:fs'];
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];
                              70, nếu không thì
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              12 sẽ là chuỗi UTF-8

                              Biến cố.
                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              05

                              Được phát ra khi người xem ngừng theo dõi các thay đổi. Đối tượng đã đóng không còn sử dụng được trong trình xử lý sự kiện

                              Biến cố.
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              04

                              Xuất hiện khi xảy ra lỗi trong khi xem tệp. Đối tượng bị lỗi không còn sử dụng được trong trình xử lý sự kiện

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              102

                              Ngừng theo dõi các thay đổi trên đã cho. Sau khi dừng, đối tượng không còn sử dụng được nữa

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              103

                              Đã thêm vào. v14. 3. 0, v12. 20. 0

                              Khi được gọi, yêu cầu Node. vòng lặp sự kiện js không thoát miễn là nó đang hoạt động. Gọi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              103 nhiều lần sẽ không có hiệu lực

                              Theo mặc định, tất cả các đối tượng đều được "ref'ed", khiến việc gọi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              103 thông thường không cần thiết trừ khi trước đó đã gọi
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              106

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              106

                              Đã thêm vào. v14. 3. 0, v12. 20. 0

                              Khi được gọi, đối tượng hoạt động sẽ không yêu cầu Nút. vòng lặp sự kiện js để duy trì hoạt động. Nếu không có hoạt động nào khác giữ cho vòng lặp sự kiện chạy, quy trình có thể thoát trước khi lệnh gọi lại của đối tượng được gọi. Gọi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              106 nhiều lần sẽ không có hiệu lực

                              Lớp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              109

                              Đã thêm vào. v14. 3. 0, v12. 20. 0

                              Một cuộc gọi thành công đến phương thức

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              393 sẽ trả về một đối tượng mới

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              103

                              Đã thêm vào. v14. 3. 0, v12. 20. 0

                              Khi được gọi, yêu cầu Node. vòng lặp sự kiện js không thoát miễn là nó đang hoạt động. Gọi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              103 nhiều lần sẽ không có hiệu lực

                              Theo mặc định, tất cả các đối tượng đều được "ref'ed", khiến việc gọi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              103 thông thường không cần thiết trừ khi trước đó đã gọi
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              106

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              106

                              Đã thêm vào. v14. 3. 0, v12. 20. 0

                              Khi được gọi, đối tượng hoạt động sẽ không yêu cầu Nút. vòng lặp sự kiện js để duy trì hoạt động. Nếu không có hoạt động nào khác giữ cho vòng lặp sự kiện chạy, quy trình có thể thoát trước khi lệnh gọi lại của đối tượng được gọi. Gọi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              106 nhiều lần sẽ không có hiệu lực

                              Lớp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              117

                              Các trường hợp được tạo và trả về bằng cách sử dụng hàm

                              Biến cố.
                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              05

                              Được phát ra khi bộ mô tả tệp cơ bản của đã bị đóng

                              Biến cố.
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              056

                              Được phát ra khi bộ mô tả tệp của đã được mở

                              Biến cố.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              121

                              Phát ra khi đã sẵn sàng để được sử dụng

                              Cháy ngay sau

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              056

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              123

                              Số lượng byte đã được đọc cho đến nay

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              124

                              Đường dẫn đến tệp mà luồng đang đọc từ đó như được chỉ định trong đối số đầu tiên của

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              051. Nếu
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 được truyền dưới dạng chuỗi, thì
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              124 sẽ là chuỗi. Nếu
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 được chuyển thành a , thì
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              124 sẽ là a. Nếu chỉ định
                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              064 thì
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              124 sẽ là
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              6

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              133

                              Đã thêm vào. v11. 2. 0, v10. 16. 0

                              Thuộc tính này là

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu tệp cơ bản chưa được mở, tôi. e. trước khi sự kiện
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              121 được phát ra

                              Lớp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              136

                              Lịch sửPhiên bảnChangesv8. 1. 0

                              Đã thêm lần dưới dạng số

                              v0. 1. 21

                              Đã thêm vào. v0. 1. 21

                              Một đối tượng cung cấp thông tin về một tập tin

                              Các đối tượng được trả về từ , , và các đối tượng đồng bộ của chúng thuộc loại này. Nếu

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              470 trong
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              78 được truyền cho các phương thức đó là đúng, thì các giá trị số sẽ là
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              470 thay vì
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              77 và đối tượng sẽ chứa các thuộc tính chính xác nano giây bổ sung có hậu tố là
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              144

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              28

                              Phiên bản

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              470

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              29
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              146

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một thiết bị khối

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              148

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một thiết bị ký tự

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              150

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả thư mục hệ thống tệp

                              Nếu đối tượng được lấy từ , phương thức này sẽ luôn trả về

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              01. Điều này là do trả về thông tin về chính liên kết tượng trưng chứ không phải đường dẫn mà nó giải quyết

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              155

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả ống nhập trước xuất trước [FIFO]

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              157

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một tệp thông thường

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              159

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một ổ cắm

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              161

                              Trả về

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu đối tượng mô tả một liên kết tượng trưng

                              Phương pháp này chỉ có hiệu lực khi sử dụng

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              164

                              Số nhận dạng của thiết bị chứa tệp

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              165

                              Số "Inode" cụ thể của hệ thống tệp cho tệp

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              166

                              Một trường bit mô tả loại tệp và chế độ

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              167

                              Số lượng liên kết cứng tồn tại cho tệp

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              168

                              Định danh người dùng dạng số của người dùng sở hữu tệp [POSIX]

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              169

                              Số nhận dạng nhóm số của nhóm sở hữu tệp [POSIX]

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              170

                              Số nhận dạng thiết bị số nếu tệp đại diện cho một thiết bị

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              171

                              Kích thước của tệp tính bằng byte

                              Nếu hệ thống tệp cơ bản không hỗ trợ nhận kích thước của tệp, điều này sẽ là

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              39

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              173

                              Kích thước khối hệ thống tệp cho các thao tác i/o

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              174

                              Số khối được phân bổ cho tệp này

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              175

                              Dấu thời gian cho biết lần cuối cùng tệp này được truy cập được biểu thị bằng mili giây kể từ Kỷ nguyên POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              176

                              Dấu thời gian cho biết lần cuối cùng tệp này được sửa đổi được biểu thị bằng mili giây kể từ Kỷ nguyên POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              177

                              Dấu thời gian cho biết lần cuối cùng trạng thái tệp được thay đổi được biểu thị bằng mili giây kể từ Kỷ nguyên POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              178

                              Dấu thời gian cho biết thời gian tạo tệp này được biểu thị bằng mili giây kể từ Kỷ nguyên POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              179

                              Chỉ xuất hiện khi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              180 được chuyển vào phương thức tạo đối tượng. Dấu thời gian cho biết lần cuối cùng tệp này được truy cập được biểu thị bằng nano giây kể từ Kỷ nguyên POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              181

                              Chỉ xuất hiện khi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              180 được chuyển vào phương thức tạo đối tượng. Dấu thời gian cho biết lần cuối cùng tệp này được sửa đổi được biểu thị bằng nano giây kể từ Kỷ nguyên POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              183

                              Chỉ xuất hiện khi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              180 được chuyển vào phương thức tạo đối tượng. Dấu thời gian cho biết lần cuối cùng trạng thái tệp được thay đổi được biểu thị bằng nano giây kể từ Kỷ nguyên POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              185

                              Chỉ xuất hiện khi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              180 được chuyển vào phương thức tạo đối tượng. Dấu thời gian cho biết thời gian tạo tệp này được biểu thị bằng nano giây kể từ Kỷ nguyên POSIX

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              187

                              Dấu thời gian cho biết lần cuối tệp này được truy cập

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              188

                              Dấu thời gian cho biết lần cuối cùng tệp này được sửa đổi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              189

                              Dấu thời gian cho biết lần cuối trạng thái tệp được thay đổi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              190

                              Dấu thời gian cho biết thời gian tạo tệp này

                              Giá trị thời gian thống kê

                              Các thuộc tính

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              191,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              192,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              193,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              194 là các giá trị số chứa thời gian tương ứng tính bằng mili giây. Độ chính xác của chúng là nền tảng cụ thể. Khi
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              180 được chuyển vào phương thức tạo đối tượng, các thuộc tính sẽ là bigint, nếu không chúng sẽ là

                              Các thuộc tính

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              196,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              197,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              198,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              199 là các bigint giữ thời gian tương ứng tính bằng nano giây. Chúng chỉ xuất hiện khi
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              180 được truyền vào phương thức tạo đối tượng. Độ chính xác của chúng là nền tảng cụ thể

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              03,
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              04,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              203 và
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              204 là các đại diện thay thế đối tượng của
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              05 trong các thời điểm khác nhau. Giá trị
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              05 và số không được kết nối. Việc chỉ định một giá trị số mới hoặc thay đổi giá trị
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              05 sẽ không được phản ánh trong biểu diễn thay thế tương ứng

                              Thời gian trong đối tượng stat có ngữ nghĩa sau

                              • import { open } from 'node:fs/promises';
                                
                                const fd = await open['sample.txt'];
                                fd.createReadStream[{ start: 90, end: 99 }];
                                03 "Thời gian truy cập". Thời gian khi dữ liệu tệp được truy cập lần cuối. Được thay đổi bởi các cuộc gọi hệ thống
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                209,
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                210 và
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                211
                              • import { open } from 'node:fs/promises';
                                
                                const fd = await open['sample.txt'];
                                fd.createReadStream[{ start: 90, end: 99 }];
                                04 "Thời gian sửa đổi". Thời gian khi dữ liệu tệp được sửa đổi lần cuối. Được thay đổi bởi các cuộc gọi hệ thống
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                209,
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                210 và
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                215
                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                203 "Thay đổi thời gian". Thời gian khi trạng thái tệp được thay đổi lần cuối [sửa đổi dữ liệu inode]. Được thay đổi bởi các cuộc gọi hệ thống
                                import * as fs from 'node:fs';const fs = require['node:fs'];
                                07,
                                import * as fs from 'node:fs';const fs = require['node:fs'];
                                72,
                                import { unlink } from 'node:fs';
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];const { unlink } = require['node:fs'];
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];
                                26,
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                209,
                                import * as fs from 'node:fs';const fs = require['node:fs'];
                                229,
                                import { open } from 'node:fs/promises';
                                
                                const fd = await open['sample.txt'];
                                fd.createReadStream[{ start: 90, end: 99 }];
                                00,
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                210,
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                211 và
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                215
                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                204 "Giờ sinh". Thời gian tạo tập tin. Đặt một lần khi tệp được tạo. Trên các hệ thống tệp không có sẵn thời gian sinh, thay vào đó, trường này có thể chứa
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                203 hoặc
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                228 [tức là dấu thời gian kỷ nguyên Unix
                                import * as fs from 'node:fs';const fs = require['node:fs'];
                                39]. Giá trị này có thể lớn hơn
                                import { open } from 'node:fs/promises';
                                
                                const fd = await open['sample.txt'];
                                fd.createReadStream[{ start: 90, end: 99 }];
                                03 hoặc
                                import { open } from 'node:fs/promises';
                                
                                const fd = await open['sample.txt'];
                                fd.createReadStream[{ start: 90, end: 99 }];
                                04 trong trường hợp này. Trên Darwin và các biến thể FreeBSD khác, cũng được đặt nếu
                                import { open } from 'node:fs/promises';
                                
                                const fd = await open['sample.txt'];
                                fd.createReadStream[{ start: 90, end: 99 }];
                                03 được đặt rõ ràng thành giá trị sớm hơn giá trị hiện tại của
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                204 bằng lệnh gọi hệ thống
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                210

                              Trước nút. js 0. 12,

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              203 giữ
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              204 trên hệ thống Windows. kể từ 0. 12,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              203 không phải là "thời gian sáng tạo" và trên các hệ thống Unix, nó chưa bao giờ là

                              Lớp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              238

                              Các trường hợp được tạo và trả về bằng cách sử dụng hàm

                              Biến cố.
                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              05

                              Được phát ra khi bộ mô tả tệp cơ bản của đã bị đóng

                              Biến cố.
                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              056

                              Phát ra khi tệp của được mở

                              Biến cố.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              121

                              Phát ra khi đã sẵn sàng để được sử dụng

                              Cháy ngay sau

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              056

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              244

                              Số lượng byte được ghi cho đến nay. Không bao gồm dữ liệu vẫn đang xếp hàng để ghi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              245

                              Đóng

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              246. Tùy chọn chấp nhận một cuộc gọi lại sẽ được thực hiện sau khi đóng
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              246

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              248

                              Đường dẫn đến tệp mà luồng đang ghi vào như được chỉ định trong đối số đầu tiên của. Nếu

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 được truyền dưới dạng chuỗi, thì
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              248 sẽ là chuỗi. Nếu
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 được chuyển thành a , thì
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              248 sẽ là a

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              254

                              Thuộc tính này là

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              97 nếu tệp cơ bản chưa được mở, tôi. e. trước khi sự kiện
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              121 được phát ra

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              47

                              Trả về một đối tượng chứa các hằng số thường được sử dụng cho các hoạt động của hệ thống tệp

                              hằng số FS

                              Các hằng số sau đây được xuất bởi

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              47 và
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              46

                              Không phải mọi hằng số sẽ có sẵn trên mọi hệ điều hành; . Đối với các ứng dụng di động, nên kiểm tra sự hiện diện của chúng trước khi sử dụng

                              Để sử dụng nhiều hơn một hằng số, hãy sử dụng toán tử bitwise OR

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              260

                              Ví dụ

                              Hằng số truy cập tệp

                              Các hằng số sau đây được dùng làm tham số

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              48 được truyền cho , và

                              ConstantDescription
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              265Cờ cho biết tệp hiển thị với quy trình gọi. Điều này hữu ích để xác định xem một tệp có tồn tại hay không, nhưng không nói gì về quyền của
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              266. Mặc định nếu không có chế độ nào được chỉ định.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              267Cờ cho biết quá trình gọi có thể đọc tệp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              268Cờ chỉ ra rằng tệp có thể được ghi bởi quá trình gọi.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              269Cờ chỉ ra rằng tệp có thể được thực thi bởi quy trình gọi. Điều này không ảnh hưởng đến Windows [sẽ hoạt động như
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              50]

                              Các định nghĩa cũng có sẵn trên Windows

                              Hằng số sao chép tệp

                              Các hằng số sau đây có nghĩa là để sử dụng với

                              ConstantDescription
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              272Nếu có, thao tác sao chép sẽ không thành công với lỗi nếu đường dẫn đích đã tồn tại.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              273Nếu có, thao tác sao chép sẽ cố gắng tạo liên kết giới thiệu sao chép khi ghi. Nếu nền tảng cơ bản không hỗ trợ sao chép khi ghi, thì cơ chế sao chép dự phòng sẽ được sử dụng.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              274Nếu có, thao tác sao chép sẽ cố gắng tạo liên kết giới thiệu sao chép khi ghi. Nếu nền tảng cơ bản không hỗ trợ sao chép khi ghi, thì thao tác sẽ không thành công với lỗi

                              Các định nghĩa cũng có sẵn trên Windows

                              Các hằng số mở tệp

                              Các hằng số sau đây được dùng với

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              64

                              ConstantDescription
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              276Cờ cho biết mở tệp để truy cập chỉ đọc.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              277Cờ cho biết mở tệp để truy cập chỉ ghi.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              278Cờ cho biết mở tệp để truy cập đọc-ghi.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              279Cờ cho biết để tạo tệp nếu nó chưa tồn tại.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              280Cờ cho biết rằng việc mở tệp sẽ không thành công nếu cờ
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              279 được đặt và tệp đã tồn tại.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              282Cờ chỉ ra rằng nếu đường dẫn xác định một thiết bị đầu cuối, thì việc mở đường dẫn sẽ không khiến thiết bị đầu cuối đó trở thành thiết bị đầu cuối kiểm soát quy trình [nếu quy trình chưa có].
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              283Cờ chỉ ra rằng nếu tệp tồn tại và là một tệp thông thường và tệp được mở thành công để truy cập ghi, thì độ dài của tệp sẽ bị cắt ngắn thành 0.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              284Cờ cho biết dữ liệu sẽ được thêm vào cuối tệp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              285Cờ chỉ ra rằng việc mở sẽ thất bại nếu đường dẫn không phải là một thư mục.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              286Cờ cho biết quyền truy cập đọc vào hệ thống tệp sẽ không còn dẫn đến cập nhật thông tin
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              03 được liên kết với tệp. Cờ này chỉ khả dụng trên hệ điều hành Linux.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              288Cờ chỉ ra rằng việc mở sẽ thất bại nếu đường dẫn là một liên kết tượng trưng.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              289Cờ cho biết tệp được mở cho I/O được đồng bộ hóa với các thao tác ghi đang chờ tính toàn vẹn của tệp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              290Cờ cho biết tệp được mở cho I/O được đồng bộ hóa với các thao tác ghi đang chờ tính toàn vẹn của dữ liệu.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              291Cờ chỉ ra để mở chính liên kết tượng trưng chứ không phải tài nguyên mà nó đang trỏ tới.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              292Khi được đặt, một nỗ lực sẽ được thực hiện để giảm thiểu hiệu ứng bộ nhớ đệm của tệp I/O.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              293Cờ cho biết mở tệp ở chế độ không chặn khi có thể.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              294Khi được đặt, ánh xạ tệp bộ nhớ được sử dụng để truy cập tệp. Cờ này chỉ khả dụng trên hệ điều hành Windows. Trên các hệ điều hành khác, cờ này bị bỏ qua

                              Trên Windows, chỉ có

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              284,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              279,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              280,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              276,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              278,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              283,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              277 và
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              294

                              Hằng số loại tệp

                              Các hằng số sau đây được dùng với thuộc tính

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              48 của đối tượng để xác định loại tệp

                              ConstantDescription
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              304Bit mask được sử dụng để trích xuất mã loại tệp.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              305Hằng số loại tệp cho một tệp thông thường.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              306Hằng số loại tệp cho một thư mục.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              307Hằng số loại tệp cho tệp thiết bị định hướng ký tự.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              308Hằng số loại tệp cho tệp thiết bị hướng khối.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              309Hằng số loại tệp cho FIFO/đường ống.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              310Hằng số loại tệp cho một liên kết tượng trưng.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              311Hằng số loại tệp cho ổ cắm

                              Trên Windows, chỉ có

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              307,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              306,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              310,
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              304 và
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              305

                              Hằng số chế độ tệp

                              Các hằng số sau đây được dùng với thuộc tính

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              48 của đối tượng để xác định quyền truy cập đối với một tệp

                              ConstantDescription
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              318Chế độ tệp cho biết chủ sở hữu có thể đọc, ghi và thực thi.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              319Chế độ tệp cho biết chủ sở hữu có thể đọc được.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              320Chế độ tệp cho biết chủ sở hữu có thể ghi.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              321Chế độ tệp cho biết chủ sở hữu có thể thực thi được.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              322Chế độ tệp cho biết có thể đọc, ghi và thực thi theo nhóm.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              323Chế độ tệp cho biết có thể đọc được theo nhóm.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              324Chế độ tệp cho biết có thể ghi theo nhóm.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              325Chế độ tệp cho biết có thể thực thi theo nhóm.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              326Chế độ tệp cho biết người khác có thể đọc, ghi và thực thi.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              327Chế độ tệp cho biết người khác có thể đọc được.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              328Chế độ tệp cho biết người khác có thể ghi.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              329Chế độ tệp cho biết người khác có thể thực thi được

                              Trên Windows, chỉ có

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              319 và
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              320

                              ghi chú

                              Thứ tự gọi lại và các hoạt động dựa trên lời hứa

                              Bởi vì chúng được thực thi không đồng bộ bởi nhóm luồng bên dưới, nên không có thứ tự được đảm bảo khi sử dụng phương pháp gọi lại hoặc dựa trên lời hứa

                              Ví dụ: phần sau dễ bị lỗi vì thao tác

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              330 có thể hoàn thành trước thao tác
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              333

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              0

                              Điều quan trọng là phải sắp xếp đúng thứ tự các thao tác bằng cách đợi kết quả của thao tác này trước khi gọi thao tác kia

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              1

                              Hoặc, khi sử dụng API gọi lại, hãy di chuyển lệnh gọi

                              import * as fs from 'node:fs';const fs = require['node:fs'];
                              330 vào lệnh gọi lại của hoạt động
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              333

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              2

                              Đường dẫn tệp

                              Hầu hết các hoạt động của

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              56 chấp nhận đường dẫn tệp có thể được chỉ định ở dạng chuỗi, a hoặc đối tượng bằng giao thức
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54

                              Đường dẫn chuỗi

                              Đường dẫn chuỗi được hiểu là chuỗi ký tự UTF-8 xác định tên tệp tuyệt đối hoặc tương đối. Đường dẫn tương đối sẽ được giải quyết liên quan đến thư mục làm việc hiện tại như được xác định bằng cách gọi

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              338

                              Ví dụ sử dụng đường dẫn tuyệt đối trên POSIX

                              Ví dụ sử dụng đường dẫn tương đối trên POSIX [liên quan đến

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              338]

                              Đường dẫn URL tệp

                              Đối với hầu hết các hàm mô-đun

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              4, đối số
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              47 hoặc
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              12 có thể được truyền dưới dạng đối tượng bằng cách sử dụng giao thức
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              3

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54 URL luôn là đường dẫn tuyệt đối

                              Cân nhắc về nền tảng cụ thể

                              Trên Windows,

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54 s với tên máy chủ chuyển đổi thành đường dẫn UNC, trong khi
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54 s với ký tự ổ đĩa chuyển đổi thành đường dẫn tuyệt đối cục bộ.
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54 s không có tên máy chủ và không có ký tự ổ đĩa sẽ dẫn đến lỗi

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54 s với ký tự ổ đĩa phải sử dụng
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              349 làm dấu phân cách ngay sau ký tự ổ đĩa. Sử dụng dấu phân cách khác sẽ dẫn đến lỗi

                              Trên tất cả các nền tảng khác,

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54 s có tên máy chủ không được hỗ trợ và sẽ gây ra lỗi

                              Một

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54 có các ký tự gạch chéo được mã hóa sẽ dẫn đến lỗi trên tất cả các nền tảng

                              Trên Windows,

                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              54 s có dấu gạch chéo ngược được mã hóa sẽ dẫn đến lỗi

                              đường dẫn bộ đệm

                              Đường dẫn được chỉ định bằng cách sử dụng a chủ yếu hữu ích trên một số hệ điều hành POSIX coi đường dẫn tệp là chuỗi byte mờ. Trên các hệ thống như vậy, một đường dẫn tệp duy nhất có thể chứa các chuỗi con sử dụng nhiều mã hóa ký tự. Như với đường dẫn chuỗi, đường dẫn có thể là tương đối hoặc tuyệt đối

                              Ví dụ sử dụng đường dẫn tuyệt đối trên POSIX

                              Thư mục làm việc trên mỗi ổ đĩa trên Windows

                              Trên Windows, nút. js tuân theo khái niệm thư mục làm việc trên mỗi ổ đĩa. Hành vi này có thể được quan sát thấy khi sử dụng đường dẫn ổ đĩa không có dấu gạch chéo ngược. Ví dụ:

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              353 có khả năng trả về một kết quả khác với
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              354. Để biết thêm thông tin, xem

                              bộ mô tả tệp

                              Trên các hệ thống POSIX, đối với mọi quy trình, kernel duy trì một bảng các tệp và tài nguyên hiện đang mở. Mỗi tệp đang mở được gán một mã định danh số đơn giản được gọi là bộ mô tả tệp. Ở cấp hệ thống, tất cả các hoạt động của hệ thống tệp đều sử dụng các bộ mô tả tệp này để xác định và theo dõi từng tệp cụ thể. Các hệ thống Windows sử dụng một cơ chế khác nhưng tương tự về mặt khái niệm để theo dõi tài nguyên. Để đơn giản hóa mọi thứ cho người dùng, Node. js trừu tượng hóa sự khác biệt giữa các hệ điều hành và gán cho tất cả các tệp đang mở một bộ mô tả tệp số

                              Các phương thức

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              64 dựa trên gọi lại và
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              93 đồng bộ mở một tệp và phân bổ một bộ mô tả tệp mới. Sau khi được phân bổ, bộ mô tả tệp có thể được sử dụng để đọc dữ liệu, ghi dữ liệu vào hoặc yêu cầu thông tin về tệp

                              Hệ điều hành giới hạn số lượng bộ mô tả tệp có thể được mở tại bất kỳ thời điểm nào, do đó, điều quan trọng là phải đóng bộ mô tả khi hoàn thành các thao tác. Không làm như vậy sẽ dẫn đến rò rỉ bộ nhớ, cuối cùng sẽ khiến ứng dụng bị sập

                              Các API dựa trên lời hứa sử dụng một đối tượng thay cho bộ mô tả tệp số. Các đối tượng này được hệ thống quản lý tốt hơn đảm bảo tài nguyên không bị rò rỉ. Tuy nhiên, chúng vẫn được yêu cầu đóng lại khi hoạt động hoàn tất

                              sử dụng threadpool

                              Tất cả API hệ thống tệp gọi lại và dựa trên lời hứa [ngoại trừ

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              357] đều sử dụng nhóm luồng của libuv. Điều này có thể có ý nghĩa hiệu suất đáng ngạc nhiên và tiêu cực đối với một số ứng dụng. Xem tài liệu để cho biết thêm thông tin chi tiết

                              Cờ hệ thống tập tin

                              Các cờ sau có sẵn ở bất cứ nơi nào tùy chọn

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              359 lấy một chuỗi

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                360. Mở tệp để nối thêm. Tệp được tạo nếu nó không tồn tại

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                361. Giống như
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                360 nhưng không thành công nếu đường dẫn tồn tại

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                363. Mở tệp để đọc và nối thêm. Tệp được tạo nếu nó không tồn tại

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                364. Giống như
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                363 nhưng không thành công nếu đường dẫn tồn tại

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                366. Mở tệp để nối thêm ở chế độ đồng bộ. Tệp được tạo nếu nó không tồn tại

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                367. Mở tệp để đọc và nối thêm ở chế độ đồng bộ. Tệp được tạo nếu nó không tồn tại

                              • import { unlink } from 'node:fs';
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];const { unlink } = require['node:fs'];
                                
                                unlink['/tmp/hello', [err] => {
                                  if [err] throw err;
                                  console.log['successfully deleted /tmp/hello'];
                                }];
                                57. Mở tệp để đọc. Một ngoại lệ xảy ra nếu tệp không tồn tại

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                369. Mở tệp để đọc và ghi. Một ngoại lệ xảy ra nếu tệp không tồn tại

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                370. Mở tệp để đọc và ghi ở chế độ đồng bộ. Hướng dẫn hệ điều hành bỏ qua bộ đệm ẩn của hệ thống tệp cục bộ

                                Điều này chủ yếu hữu ích để mở các tệp trên các ngàm NFS vì nó cho phép bỏ qua bộ đệm cục bộ có khả năng cũ. Nó có tác động rất thực đến hiệu năng I/O nên không nên sử dụng cờ này trừ khi cần thiết

                                Điều này không biến

                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                64 hoặc
                                import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                                03 thành cuộc gọi chặn đồng bộ. Nếu muốn hoạt động đồng bộ, nên sử dụng một cái gì đó như
                                import { open } from 'node:fs/promises';
                                
                                const fd = await open['sample.txt'];
                                fd.createReadStream[{ start: 90, end: 99 }];
                                93

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                374. Mở tệp để viết. Tệp được tạo [nếu không tồn tại] hoặc bị cắt bớt [nếu tồn tại]

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                375. Giống như
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                374 nhưng không thành công nếu đường dẫn tồn tại

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                377. Mở tệp để đọc và ghi. Tệp được tạo [nếu không tồn tại] hoặc bị cắt bớt [nếu tồn tại]

                              • import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                378. Giống như
                                import { unlink } from 'node:fs/promises';
                                
                                try {
                                  await unlink['/tmp/hello'];
                                  console.log['successfully deleted /tmp/hello'];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }const { unlink } = require['node:fs/promises'];
                                
                                [async function[path] {
                                  try {
                                    await unlink[path];
                                    console.log[`successfully deleted ${path}`];
                                  } catch [error] {
                                    console.error['there was an error:', error.message];
                                  }
                                }]['/tmp/hello'];
                                377 nhưng không thành công nếu đường dẫn tồn tại

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              359 cũng có thể là một số như được ghi lại bởi
                              import { unlink } from 'node:fs';
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];const { unlink } = require['node:fs'];
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];
                              58; . Trên Windows, các cờ được dịch sang các cờ tương đương nếu có, ví dụ:. g.
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              277 đến
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              384, hoặc
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              385 đến
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              386, như được chấp nhận bởi
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              387

                              Cờ độc quyền

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              388 [cờ
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              280 trong
                              import { unlink } from 'node:fs';
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];const { unlink } = require['node:fs'];
                              
                              unlink['/tmp/hello', [err] => {
                                if [err] throw err;
                                console.log['successfully deleted /tmp/hello'];
                              }];
                              58] khiến thao tác trả về lỗi nếu đường dẫn đã tồn tại. Trên POSIX, nếu đường dẫn là một liên kết tượng trưng, ​​việc sử dụng
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              280 sẽ trả về lỗi ngay cả khi liên kết đến một đường dẫn không tồn tại. Cờ độc quyền có thể không hoạt động với hệ thống tệp mạng

                              Trên Linux, chức năng ghi theo vị trí không hoạt động khi tệp được mở ở chế độ chắp thêm. Hạt nhân bỏ qua đối số vị trí và luôn nối thêm dữ liệu vào cuối tệp

                              Sửa đổi một tệp thay vì thay thế nó có thể yêu cầu tùy chọn

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              359 được đặt thành
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              369 thay vì mặc định là
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              374

                              Hành vi của một số cờ là dành riêng cho nền tảng. Như vậy, việc mở một thư mục trên macOS và Linux bằng cờ

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              363, như trong ví dụ bên dưới, sẽ trả về lỗi. Ngược lại, trên Windows và FreeBSD, một bộ mô tả tệp hoặc một
                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              02 sẽ được trả về

                              Trên Windows, mở một tệp ẩn hiện có bằng cờ

                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              374 [thông qua
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              64,
                              import { open } from 'node:fs/promises';
                              
                              const fd = await open['sample.txt'];
                              fd.createReadStream[{ start: 90, end: 99 }];
                              76 hoặc
                              import * as fs from 'node:fs/promises';const fs = require['node:fs/promises'];
                              03] sẽ không thành công với
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              228. Các tệp ẩn hiện có có thể được mở để ghi bằng cờ
                              import { unlink } from 'node:fs/promises';
                              
                              try {
                                await unlink['/tmp/hello'];
                                console.log['successfully deleted /tmp/hello'];
                              } catch [error] {
                                console.error['there was an error:', error.message];
                              }const { unlink } = require['node:fs/promises'];
                              
                              [async function[path] {
                                try {
                                  await unlink[path];
                                  console.log[`successfully deleted ${path}`];
                                } catch [error] {
                                  console.error['there was an error:', error.message];
                                }
                              }]['/tmp/hello'];
                              369

                              Làm cách nào để đọc tệp đầu vào trong JavaScript?

                              Để đọc tệp, sử dụng FileReader , cho phép bạn đọc nội dung của đối tượng Tệp vào bộ nhớ. Bạn có thể hướng dẫn FileReader đọc tệp dưới dạng bộ đệm mảng, URL dữ liệu hoặc văn bản. // Kiểm tra xem file có phải là ảnh không.

                              Có thể xử lý tệp trong JavaScript không?

                              Xử lý tệp trong JavaScript là một kỹ thuật trong đó tệp được viết ở định dạng html bằng cách sử dụng CSS có thể được gọi bằng cách sử dụng tệp html bên ngoài hoặc sử dụng. tệp js trỏ đến tệp html đó . Thao tác xử lý tệp trong JavaScript bao gồm mở tệp, đóng tệp, Cập nhật dữ liệu trong tệp.

                              Làm cách nào để tải một tệp trong JavaScript?

                              Để tải động tệp JavaScript. .
                              Tạo phần tử tập lệnh
                              Đặt các thuộc tính src , async và type
                              Nối phần tử tập lệnh vào phần thân
                              Kiểm tra xem tệp có được tải hay không trong sự kiện tải

                              Làm cách nào để đọc một tệp trong JavaScript theo từng dòng?

                              Trong JavaScript, phương thức tích hợp sẵn FileReader[] cùng với mô-đun readline có thể được sử dụng để đọc từng dòng tệp . Phương thức FileReader[] đọc nội dung của các tệp được lưu trữ trên hệ thống cục bộ. Hơn nữa, mô-đun readline thực hiện việc đọc nội dung. Cả hai phương pháp này đều yêu cầu nguồn của tệp.

Chủ Đề