@gjsify/fs 0.3.12 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,357 +1,356 @@
1
+ import { normalizePath } from "./utils.js";
2
+ import { BigIntStats, STAT_ATTRIBUTES, Stats } from "./stats.js";
3
+ import { FileHandle } from "./file-handle.js";
4
+ import { createNodeError } from "./errors.js";
5
+ import { accessSync, appendFileSync, chmodSync, chownSync, copyFileSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmdirSync, truncateSync, writeFileSync } from "./sync.js";
6
+ import { open as open$1, rm as rm$1 } from "./promises.js";
1
7
  import GLib from "@girs/glib-2.0";
2
8
  import Gio from "@girs/gio-2.0";
3
- import { open as openP, rm as rmP } from "./promises.js";
4
- import { FileHandle } from "./file-handle.js";
5
9
  import { Buffer } from "node:buffer";
6
- import { Stats, BigIntStats, STAT_ATTRIBUTES } from "./stats.js";
7
- import { createNodeError } from "./errors.js";
8
- import { realpathSync, readdirSync, renameSync, copyFileSync, accessSync, appendFileSync, readlinkSync, truncateSync, chmodSync, chownSync, mkdirSync, rmdirSync, readFileSync, writeFileSync } from "./sync.js";
9
- import { normalizePath } from "./utils.js";
10
+
11
+ //#region src/callback.ts
10
12
  function parseOptsCb(optionsOrCallback, maybeCallback) {
11
- return typeof optionsOrCallback === "function" ? { options: {}, callback: optionsOrCallback } : { options: optionsOrCallback ?? {}, callback: maybeCallback };
13
+ return typeof optionsOrCallback === "function" ? {
14
+ options: {},
15
+ callback: optionsOrCallback
16
+ } : {
17
+ options: optionsOrCallback ?? {},
18
+ callback: maybeCallback
19
+ };
12
20
  }
13
21
  function statImpl(path, flags, syscall, options, callback) {
14
- const pathStr = normalizePath(path);
15
- const file = Gio.File.new_for_path(pathStr);
16
- file.query_info_async(STAT_ATTRIBUTES, flags, GLib.PRIORITY_DEFAULT, null, (_s, res) => {
17
- try {
18
- const info = file.query_info_finish(res);
19
- callback(null, options?.bigint ? new BigIntStats(info, pathStr) : new Stats(info, pathStr));
20
- } catch (err) {
21
- callback(createNodeError(err, syscall, pathStr));
22
- }
23
- });
22
+ const pathStr = normalizePath(path);
23
+ const file = Gio.File.new_for_path(pathStr);
24
+ file.query_info_async(STAT_ATTRIBUTES, flags, GLib.PRIORITY_DEFAULT, null, (_s, res) => {
25
+ try {
26
+ const info = file.query_info_finish(res);
27
+ callback(null, options?.bigint ? new BigIntStats(info, pathStr) : new Stats(info, pathStr));
28
+ } catch (err) {
29
+ callback(createNodeError(err, syscall, pathStr));
30
+ }
31
+ });
24
32
  }
25
33
  function stat(path, optionsOrCallback, maybeCallback) {
26
- const { options, callback } = parseOptsCb(optionsOrCallback, maybeCallback);
27
- statImpl(path, Gio.FileQueryInfoFlags.NONE, "stat", options, callback);
34
+ const { options, callback } = parseOptsCb(optionsOrCallback, maybeCallback);
35
+ statImpl(path, Gio.FileQueryInfoFlags.NONE, "stat", options, callback);
28
36
  }
29
37
  function lstat(path, optionsOrCallback, maybeCallback) {
30
- const { options, callback } = parseOptsCb(optionsOrCallback, maybeCallback);
31
- statImpl(path, Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, "lstat", options, callback);
38
+ const { options, callback } = parseOptsCb(optionsOrCallback, maybeCallback);
39
+ statImpl(path, Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, "lstat", options, callback);
32
40
  }
33
41
  function readdir(path, optionsOrCallback, maybeCallback) {
34
- const { options, callback } = parseOptsCb(optionsOrCallback, maybeCallback);
35
- Promise.resolve().then(() => {
36
- try {
37
- callback(null, readdirSync(path, options));
38
- } catch (err) {
39
- callback(createNodeError(err, "readdir", path));
40
- }
41
- });
42
+ const { options, callback } = parseOptsCb(optionsOrCallback, maybeCallback);
43
+ Promise.resolve().then(() => {
44
+ try {
45
+ callback(null, readdirSync(path, options));
46
+ } catch (err) {
47
+ callback(createNodeError(err, "readdir", path));
48
+ }
49
+ });
42
50
  }
43
51
  function realpath(path, optionsOrCallback, maybeCallback) {
44
- const { callback } = parseOptsCb(optionsOrCallback, maybeCallback);
45
- Promise.resolve().then(() => {
46
- try {
47
- callback(null, realpathSync(path));
48
- } catch (err) {
49
- callback(err);
50
- }
51
- });
52
+ const { callback } = parseOptsCb(optionsOrCallback, maybeCallback);
53
+ Promise.resolve().then(() => {
54
+ try {
55
+ callback(null, realpathSync(path));
56
+ } catch (err) {
57
+ callback(err);
58
+ }
59
+ });
52
60
  }
53
61
  function symlink(target, path, typeOrCallback, maybeCallback) {
54
- const callback = typeof typeOrCallback === "function" ? typeOrCallback : maybeCallback;
55
- if (typeof callback !== "function") {
56
- throw new TypeError("Callback must be a function. Received " + typeof callback);
57
- }
58
- const pathStr = normalizePath(path);
59
- const targetStr = normalizePath(target);
60
- const file = Gio.File.new_for_path(pathStr);
61
- file.make_symbolic_link_async(targetStr, GLib.PRIORITY_DEFAULT, null, (_s, res) => {
62
- try {
63
- file.make_symbolic_link_finish(res);
64
- callback(null);
65
- } catch (err) {
66
- callback(createNodeError(err, "symlink", targetStr, pathStr));
67
- }
68
- });
62
+ const callback = typeof typeOrCallback === "function" ? typeOrCallback : maybeCallback;
63
+ if (typeof callback !== "function") {
64
+ throw new TypeError("Callback must be a function. Received " + typeof callback);
65
+ }
66
+ const pathStr = normalizePath(path);
67
+ const targetStr = normalizePath(target);
68
+ const file = Gio.File.new_for_path(pathStr);
69
+ file.make_symbolic_link_async(targetStr, GLib.PRIORITY_DEFAULT, null, (_s, res) => {
70
+ try {
71
+ file.make_symbolic_link_finish(res);
72
+ callback(null);
73
+ } catch (err) {
74
+ callback(createNodeError(err, "symlink", targetStr, pathStr));
75
+ }
76
+ });
69
77
  }
70
78
  function open(path, ...args) {
71
- let flags;
72
- let mode;
73
- let callback;
74
- switch (args.length) {
75
- case 1:
76
- callback = args[0];
77
- break;
78
- case 2:
79
- flags = args[0];
80
- callback = args[1];
81
- break;
82
- case 3:
83
- flags = args[0];
84
- mode = args[1];
85
- callback = args[2];
86
- break;
87
- default:
88
- break;
89
- }
90
- openP(path, flags, mode).then((fileHandle) => {
91
- callback(null, fileHandle.fd);
92
- }).catch((err) => {
93
- callback(err, -1);
94
- });
79
+ let flags;
80
+ let mode;
81
+ let callback;
82
+ switch (args.length) {
83
+ case 1:
84
+ callback = args[0];
85
+ break;
86
+ case 2:
87
+ flags = args[0];
88
+ callback = args[1];
89
+ break;
90
+ case 3:
91
+ flags = args[0];
92
+ mode = args[1];
93
+ callback = args[2];
94
+ break;
95
+ default: break;
96
+ }
97
+ open$1(path, flags, mode).then((fileHandle) => {
98
+ callback(null, fileHandle.fd);
99
+ }).catch((err) => {
100
+ callback(err, -1);
101
+ });
95
102
  }
96
103
  function write(fd, data, ...args) {
97
- const fileHandle = FileHandle.getInstance(fd);
98
- if (typeof data === "string") {
99
- const callback2 = args.pop();
100
- const position2 = args[0];
101
- const encoding = args[1];
102
- fileHandle.write(data, position2, encoding).then((res) => {
103
- callback2(null, res.bytesWritten, res.buffer);
104
- }).catch((err) => {
105
- callback2(err, 0, "");
106
- });
107
- return;
108
- }
109
- const callback = args[args.length - 1];
110
- const offset = args[0];
111
- const length = args[1];
112
- const position = args[2];
113
- fileHandle.write(data, offset, length, position).then((res) => {
114
- callback(null, res.bytesWritten, res.buffer);
115
- }).catch((err) => {
116
- callback(err, 0, Buffer.from([]));
117
- });
104
+ const fileHandle = FileHandle.getInstance(fd);
105
+ if (typeof data === "string") {
106
+ const callback = args.pop();
107
+ const position = args[0];
108
+ const encoding = args[1];
109
+ fileHandle.write(data, position, encoding).then((res) => {
110
+ callback(null, res.bytesWritten, res.buffer);
111
+ }).catch((err) => {
112
+ callback(err, 0, "");
113
+ });
114
+ return;
115
+ }
116
+ const callback = args[args.length - 1];
117
+ const offset = args[0];
118
+ const length = args[1];
119
+ const position = args[2];
120
+ fileHandle.write(data, offset, length, position).then((res) => {
121
+ callback(null, res.bytesWritten, res.buffer);
122
+ }).catch((err) => {
123
+ callback(err, 0, Buffer.from([]));
124
+ });
118
125
  }
119
126
  function read(fd, ...args) {
120
- const fileHandle = FileHandle.getInstance(fd);
121
- const callback = args[args.length - 1];
122
- let buffer;
123
- let offset;
124
- let length;
125
- let position;
126
- if (args.length <= 1) {
127
- } else if (typeof args[0] === "object" && !ArrayBuffer.isView(args[0])) {
128
- const options = args[0];
129
- buffer = options.buffer;
130
- offset = options.offset;
131
- length = options.length;
132
- position = options.position;
133
- } else {
134
- buffer = args[0];
135
- offset = args[1];
136
- length = args[2];
137
- position = args[3];
138
- }
139
- fileHandle.read(buffer, offset, length, position).then((res) => {
140
- callback(null, res.bytesRead, res.buffer);
141
- }).catch((err) => {
142
- callback(err, 0, Buffer.from([]));
143
- });
127
+ const fileHandle = FileHandle.getInstance(fd);
128
+ const callback = args[args.length - 1];
129
+ let buffer;
130
+ let offset;
131
+ let length;
132
+ let position;
133
+ if (args.length <= 1) {} else if (typeof args[0] === "object" && !ArrayBuffer.isView(args[0])) {
134
+ const options = args[0];
135
+ buffer = options.buffer;
136
+ offset = options.offset;
137
+ length = options.length;
138
+ position = options.position;
139
+ } else {
140
+ buffer = args[0];
141
+ offset = args[1];
142
+ length = args[2];
143
+ position = args[3];
144
+ }
145
+ fileHandle.read(buffer, offset, length, position).then((res) => {
146
+ callback(null, res.bytesRead, res.buffer);
147
+ }).catch((err) => {
148
+ callback(err, 0, Buffer.from([]));
149
+ });
144
150
  }
151
+ /**
152
+ * Closes the file descriptor. No arguments other than a possible exception are
153
+ * given to the completion callback.
154
+ *
155
+ * Calling `fs.close()` on any file descriptor (`fd`) that is currently in use
156
+ * through any other `fs` operation may lead to undefined behavior.
157
+ *
158
+ * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
159
+ * @since v0.0.2
160
+ */
145
161
  function close(fd, callback) {
146
- FileHandle.getInstance(fd).close().then(() => {
147
- callback(null);
148
- }).catch((err) => callback(err));
162
+ FileHandle.getInstance(fd).close().then(() => {
163
+ callback(null);
164
+ }).catch((err) => callback(err));
149
165
  }
150
166
  function rm(path, ...args) {
151
- let options = {};
152
- let callback = args[args.length - 1];
153
- if (args.length >= 2) {
154
- options = args[0];
155
- }
156
- rmP(path, options).then(() => {
157
- callback(null);
158
- }).catch((err) => {
159
- callback(err);
160
- });
167
+ let options = {};
168
+ let callback = args[args.length - 1];
169
+ if (args.length >= 2) {
170
+ options = args[0];
171
+ }
172
+ rm$1(path, options).then(() => {
173
+ callback(null);
174
+ }).catch((err) => {
175
+ callback(err);
176
+ });
161
177
  }
162
178
  function rename(oldPath, newPath, callback) {
163
- Promise.resolve().then(() => {
164
- try {
165
- renameSync(oldPath, newPath);
166
- callback(null);
167
- } catch (err) {
168
- callback(err);
169
- }
170
- });
179
+ Promise.resolve().then(() => {
180
+ try {
181
+ renameSync(oldPath, newPath);
182
+ callback(null);
183
+ } catch (err) {
184
+ callback(err);
185
+ }
186
+ });
171
187
  }
172
188
  function copyFile(src, dest, modeOrCb, maybeCb) {
173
- const mode = typeof modeOrCb === "function" ? 0 : modeOrCb;
174
- const callback = typeof modeOrCb === "function" ? modeOrCb : maybeCb;
175
- Promise.resolve().then(() => {
176
- try {
177
- copyFileSync(src, dest, mode);
178
- callback(null);
179
- } catch (err) {
180
- callback(err);
181
- }
182
- });
189
+ const mode = typeof modeOrCb === "function" ? 0 : modeOrCb;
190
+ const callback = typeof modeOrCb === "function" ? modeOrCb : maybeCb;
191
+ Promise.resolve().then(() => {
192
+ try {
193
+ copyFileSync(src, dest, mode);
194
+ callback(null);
195
+ } catch (err) {
196
+ callback(err);
197
+ }
198
+ });
183
199
  }
184
200
  function access(path, modeOrCb, maybeCb) {
185
- const mode = typeof modeOrCb === "function" ? void 0 : modeOrCb;
186
- const callback = typeof modeOrCb === "function" ? modeOrCb : maybeCb;
187
- Promise.resolve().then(() => {
188
- try {
189
- accessSync(path, mode);
190
- callback(null);
191
- } catch (err) {
192
- callback(err);
193
- }
194
- });
201
+ const mode = typeof modeOrCb === "function" ? undefined : modeOrCb;
202
+ const callback = typeof modeOrCb === "function" ? modeOrCb : maybeCb;
203
+ Promise.resolve().then(() => {
204
+ try {
205
+ accessSync(path, mode);
206
+ callback(null);
207
+ } catch (err) {
208
+ callback(err);
209
+ }
210
+ });
195
211
  }
196
212
  function appendFile(path, data, optsOrCb, maybeCb) {
197
- const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
198
- const options = typeof optsOrCb === "function" ? void 0 : optsOrCb;
199
- Promise.resolve().then(() => {
200
- try {
201
- appendFileSync(path, data, options);
202
- callback(null);
203
- } catch (err) {
204
- callback(err);
205
- }
206
- });
213
+ const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
214
+ const options = typeof optsOrCb === "function" ? undefined : optsOrCb;
215
+ Promise.resolve().then(() => {
216
+ try {
217
+ appendFileSync(path, data, options);
218
+ callback(null);
219
+ } catch (err) {
220
+ callback(err);
221
+ }
222
+ });
207
223
  }
208
224
  function readlink(path, optsOrCb, maybeCb) {
209
- const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
210
- const options = typeof optsOrCb === "function" ? void 0 : optsOrCb;
211
- Promise.resolve().then(() => {
212
- try {
213
- callback(null, readlinkSync(path, options));
214
- } catch (err) {
215
- callback(err, "");
216
- }
217
- });
225
+ const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
226
+ const options = typeof optsOrCb === "function" ? undefined : optsOrCb;
227
+ Promise.resolve().then(() => {
228
+ try {
229
+ callback(null, readlinkSync(path, options));
230
+ } catch (err) {
231
+ callback(err, "");
232
+ }
233
+ });
218
234
  }
219
235
  function truncate(path, lenOrCb, maybeCb) {
220
- const len = typeof lenOrCb === "function" ? 0 : lenOrCb;
221
- const callback = typeof lenOrCb === "function" ? lenOrCb : maybeCb;
222
- Promise.resolve().then(() => {
223
- try {
224
- truncateSync(path, len);
225
- callback(null);
226
- } catch (err) {
227
- callback(err);
228
- }
229
- });
236
+ const len = typeof lenOrCb === "function" ? 0 : lenOrCb;
237
+ const callback = typeof lenOrCb === "function" ? lenOrCb : maybeCb;
238
+ Promise.resolve().then(() => {
239
+ try {
240
+ truncateSync(path, len);
241
+ callback(null);
242
+ } catch (err) {
243
+ callback(err);
244
+ }
245
+ });
230
246
  }
231
247
  function chmod(path, mode, callback) {
232
- Promise.resolve().then(() => {
233
- try {
234
- chmodSync(path, mode);
235
- callback(null);
236
- } catch (err) {
237
- callback(err);
238
- }
239
- });
248
+ Promise.resolve().then(() => {
249
+ try {
250
+ chmodSync(path, mode);
251
+ callback(null);
252
+ } catch (err) {
253
+ callback(err);
254
+ }
255
+ });
240
256
  }
241
257
  function chown(path, uid, gid, callback) {
242
- Promise.resolve().then(() => {
243
- try {
244
- chownSync(path, uid, gid);
245
- callback(null);
246
- } catch (err) {
247
- callback(err);
248
- }
249
- });
258
+ Promise.resolve().then(() => {
259
+ try {
260
+ chownSync(path, uid, gid);
261
+ callback(null);
262
+ } catch (err) {
263
+ callback(err);
264
+ }
265
+ });
250
266
  }
251
267
  function mkdir(path, optsOrCb, maybeCb) {
252
- const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
253
- const options = typeof optsOrCb === "function" ? void 0 : optsOrCb;
254
- Promise.resolve().then(() => {
255
- try {
256
- mkdirSync(path, options);
257
- callback(null);
258
- } catch (err) {
259
- callback(err);
260
- }
261
- });
268
+ const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
269
+ const options = typeof optsOrCb === "function" ? undefined : optsOrCb;
270
+ Promise.resolve().then(() => {
271
+ try {
272
+ mkdirSync(path, options);
273
+ callback(null);
274
+ } catch (err) {
275
+ callback(err);
276
+ }
277
+ });
262
278
  }
263
279
  function rmdir(path, optsOrCb, maybeCb) {
264
- const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
265
- const options = typeof optsOrCb === "function" ? void 0 : optsOrCb;
266
- Promise.resolve().then(() => {
267
- try {
268
- rmdirSync(path, options);
269
- callback(null);
270
- } catch (err) {
271
- callback(err);
272
- }
273
- });
280
+ const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
281
+ const options = typeof optsOrCb === "function" ? undefined : optsOrCb;
282
+ Promise.resolve().then(() => {
283
+ try {
284
+ rmdirSync(path, options);
285
+ callback(null);
286
+ } catch (err) {
287
+ callback(err);
288
+ }
289
+ });
274
290
  }
275
291
  function readFile(path, optsOrCb, maybeCb) {
276
- const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
277
- const options = typeof optsOrCb === "function" ? void 0 : optsOrCb;
278
- const pathStr = normalizePath(path);
279
- Promise.resolve().then(() => {
280
- try {
281
- const readOpts = typeof options === "string" ? { encoding: options, flag: "r" } : { encoding: options?.encoding ?? null, flag: options?.flag ?? "r" };
282
- callback(null, readFileSync(pathStr, readOpts));
283
- } catch (err) {
284
- callback(err, null);
285
- }
286
- });
292
+ const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
293
+ const options = typeof optsOrCb === "function" ? undefined : optsOrCb;
294
+ const pathStr = normalizePath(path);
295
+ Promise.resolve().then(() => {
296
+ try {
297
+ const readOpts = typeof options === "string" ? {
298
+ encoding: options,
299
+ flag: "r"
300
+ } : {
301
+ encoding: options?.encoding ?? null,
302
+ flag: options?.flag ?? "r"
303
+ };
304
+ callback(null, readFileSync(pathStr, readOpts));
305
+ } catch (err) {
306
+ callback(err, null);
307
+ }
308
+ });
287
309
  }
288
310
  function writeFile(path, data, optsOrCb, maybeCb) {
289
- const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
290
- const pathStr = normalizePath(path);
291
- Promise.resolve().then(() => {
292
- try {
293
- writeFileSync(pathStr, data);
294
- callback(null);
295
- } catch (err) {
296
- callback(err);
297
- }
298
- });
311
+ const callback = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
312
+ const pathStr = normalizePath(path);
313
+ Promise.resolve().then(() => {
314
+ try {
315
+ writeFileSync(pathStr, data);
316
+ callback(null);
317
+ } catch (err) {
318
+ callback(err);
319
+ }
320
+ });
299
321
  }
300
322
  function link(existingPath, newPath, callback) {
301
- const existingStr = normalizePath(existingPath);
302
- const newStr = normalizePath(newPath);
303
- Promise.resolve().then(() => {
304
- try {
305
- const result = GLib.spawn_command_line_sync(`ln ${existingStr} ${newStr}`);
306
- if (!result[0]) {
307
- throw Object.assign(new Error(`EPERM: operation not permitted, link '${existingStr}' -> '${newStr}'`), {
308
- code: "EPERM",
309
- errno: -1,
310
- syscall: "link",
311
- path: existingStr,
312
- dest: newStr
313
- });
314
- }
315
- callback(null);
316
- } catch (err) {
317
- callback(err);
318
- }
319
- });
323
+ const existingStr = normalizePath(existingPath);
324
+ const newStr = normalizePath(newPath);
325
+ Promise.resolve().then(() => {
326
+ try {
327
+ const result = GLib.spawn_command_line_sync(`ln ${existingStr} ${newStr}`);
328
+ if (!result[0]) {
329
+ throw Object.assign(new Error(`EPERM: operation not permitted, link '${existingStr}' -> '${newStr}'`), {
330
+ code: "EPERM",
331
+ errno: -1,
332
+ syscall: "link",
333
+ path: existingStr,
334
+ dest: newStr
335
+ });
336
+ }
337
+ callback(null);
338
+ } catch (err) {
339
+ callback(err);
340
+ }
341
+ });
320
342
  }
321
343
  function unlink(path, callback) {
322
- const pathStr = normalizePath(path);
323
- Promise.resolve().then(() => {
324
- try {
325
- GLib.unlink(pathStr);
326
- callback(null);
327
- } catch (err) {
328
- callback(err);
329
- }
330
- });
344
+ const pathStr = normalizePath(path);
345
+ Promise.resolve().then(() => {
346
+ try {
347
+ GLib.unlink(pathStr);
348
+ callback(null);
349
+ } catch (err) {
350
+ callback(err);
351
+ }
352
+ });
331
353
  }
332
- export {
333
- access,
334
- appendFile,
335
- chmod,
336
- chown,
337
- close,
338
- copyFile,
339
- link,
340
- lstat,
341
- mkdir,
342
- open,
343
- read,
344
- readFile,
345
- readdir,
346
- readlink,
347
- realpath,
348
- rename,
349
- rm,
350
- rmdir,
351
- stat,
352
- symlink,
353
- truncate,
354
- unlink,
355
- write,
356
- writeFile
357
- };
354
+
355
+ //#endregion
356
+ export { access, appendFile, chmod, chown, close, copyFile, link, lstat, mkdir, open, read, readFile, readdir, readlink, realpath, rename, rm, rmdir, stat, symlink, truncate, unlink, write, writeFile };