1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| var fs = require('fs')
|
| var closeFilesSync = function (fd1, fd2) {
| if (fd1) {
| fs.closeSync(fd1)
| }
| if (fd2) {
| fs.closeSync(fd2)
| }
| }
|
| var closeFilesAsync = function (fd1, fd2, fdQueue) {
| if (fd1 && fd2) {
| return fdQueue.promises.close(fd1).then(() => fdQueue.promises.close(fd2))
| }
| if (fd1) {
| return fdQueue.promises.close(fd1)
| }
| if (fd2) {
| return fdQueue.promises.close(fd2)
| }
| }
|
|
| module.exports = {
| closeFilesSync: closeFilesSync,
| closeFilesAsync: closeFilesAsync
| }
|
|