Debian Codegraph @

nyc/lib/fs-promises.js

raw
1 'use strict'
2
3 const fs = require('fs')
4
5 const { promisify } = require('util')
6
7 module.exports = { ...fs }
8
9 // Promisify all functions for consistency
10 const fns = [
11 'access',
12 'appendFile',
13 'chmod',
14 'chown',
15 'close',
16 'copyFile',
17 'fchmod',
18 'fchown',
19 'fdatasync',
20 'fstat',
21 'fsync',
22 'ftruncate',
23 'futimes',
24 'lchmod',
25 'lchown',
26 'link',
27 'lstat',
28 'mkdir',
29 'mkdtemp',
30 'open',
31 'read',
32 'readdir',
33 'readFile',
34 'readlink',
35 'realpath',
36 'rename',
37 'rmdir',
38 'stat',
39 'symlink',
40 'truncate',
41 'unlink',
42 'utimes',
43 'write',
44 'writeFile'
45 ]
46 fns.forEach(fn => {
47 /* istanbul ignore else: all functions exist on OSX */
48 if (fs[fn]) {
49 module.exports[fn] = promisify(fs[fn])
50 }
51 })