@fncts/node 0.0.3 → 0.0.6
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.
- package/_cjs/fs/api.cjs +110 -112
- package/_cjs/fs/api.cjs.map +1 -1
- package/_mjs/fs/api.mjs +110 -111
- package/_mjs/fs/api.mjs.map +1 -1
- package/_src/fs/api.ts +51 -51
- package/fs/api.d.ts +9 -9
- package/package.json +2 -2
package/_src/fs/api.ts
CHANGED
@@ -3,7 +3,7 @@ import * as fs from "fs";
|
|
3
3
|
type ErrnoException = NodeJS.ErrnoException;
|
4
4
|
|
5
5
|
interface FileDescriptorN extends HKT {
|
6
|
-
|
6
|
+
type: FileDescriptor;
|
7
7
|
}
|
8
8
|
export interface FileDescriptor
|
9
9
|
extends Newtype<
|
@@ -14,12 +14,12 @@ export interface FileDescriptor
|
|
14
14
|
> {}
|
15
15
|
export const FileDescriptor = Newtype<FileDescriptorN>();
|
16
16
|
|
17
|
-
function unitErrorCallback(cb: (_: IO<
|
17
|
+
function unitErrorCallback(cb: (_: IO<never, ErrnoException, void>) => void): (err: ErrnoException | null) => void {
|
18
18
|
return (err) => (err ? cb(IO.fail(err)) : cb(IO.unit));
|
19
19
|
}
|
20
20
|
|
21
21
|
export function access(path: fs.PathLike, mode: number | undefined): FIO<ErrnoException, void> {
|
22
|
-
return IO.async<
|
22
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
23
23
|
fs.access(path, mode, (err) => (err ? cb(IO.fail(err)) : cb(IO.unit)));
|
24
24
|
});
|
25
25
|
}
|
@@ -29,31 +29,31 @@ export function appendFile(
|
|
29
29
|
data: string | Buffer,
|
30
30
|
options?: fs.WriteFileOptions,
|
31
31
|
): FIO<ErrnoException, void> {
|
32
|
-
return IO.async<
|
32
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
33
33
|
fs.appendFile(path as any, data, options ?? {}, (err) => (err ? cb(IO.fail(err)) : cb(IO.unit)));
|
34
34
|
});
|
35
35
|
}
|
36
36
|
|
37
37
|
export function chmod(path: fs.PathLike, mode: fs.Mode): FIO<ErrnoException, void> {
|
38
|
-
return IO.async<
|
38
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
39
39
|
fs.chmod(path, mode, (err) => (err ? cb(IO.fail(err)) : cb(IO.unit)));
|
40
40
|
});
|
41
41
|
}
|
42
42
|
|
43
43
|
export function close(fd: FileDescriptor): FIO<ErrnoException, void> {
|
44
|
-
return IO.async<
|
44
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
45
45
|
fs.close(FileDescriptor.reverseGet(fd), (err) => (err ? cb(IO.fail(err)) : cb(IO.unit)));
|
46
46
|
});
|
47
47
|
}
|
48
48
|
|
49
49
|
export function chown(path: fs.PathLike, uid: number, gid: number): FIO<ErrnoException, void> {
|
50
|
-
return IO.async<
|
50
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
51
51
|
fs.chown(path, uid, gid, (err) => (err ? cb(IO.fail(err)) : cb(IO.unit)));
|
52
52
|
});
|
53
53
|
}
|
54
54
|
|
55
55
|
export function copyFile(src: fs.PathLike, dest: fs.PathLike, flags: number): FIO<ErrnoException, void> {
|
56
|
-
return IO.async<
|
56
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
57
57
|
fs.copyFile(src, dest, flags, (err) => (err ? cb(IO.fail(err)) : cb(IO.unit)));
|
58
58
|
});
|
59
59
|
}
|
@@ -69,7 +69,7 @@ interface CreateReadStreamOptions {
|
|
69
69
|
export function createReadStream(
|
70
70
|
path: fs.PathLike,
|
71
71
|
options?: CreateReadStreamOptions,
|
72
|
-
): Stream<
|
72
|
+
): Stream<never, ErrnoException, Byte> {
|
73
73
|
const chunkSize = options?.chunkSize ?? 1024 * 64;
|
74
74
|
return Stream.acquireRelease(
|
75
75
|
open(path, options?.flags ?? fs.constants.O_RDONLY, options?.mode).zipC(
|
@@ -114,7 +114,7 @@ interface CreateWriteSinkOptions {
|
|
114
114
|
export function createWriteSink<InErr>(
|
115
115
|
path: fs.PathLike,
|
116
116
|
options?: CreateWriteSinkOptions,
|
117
|
-
): Sink<
|
117
|
+
): Sink<never, InErr | ErrnoException, Byte, never, void> {
|
118
118
|
return new Sink(
|
119
119
|
Channel.unwrapScoped(
|
120
120
|
Do((_) => {
|
@@ -136,7 +136,7 @@ export function createWriteSink<InErr>(
|
|
136
136
|
return reader;
|
137
137
|
} else {
|
138
138
|
const reader: Channel<
|
139
|
-
|
139
|
+
never,
|
140
140
|
InErr,
|
141
141
|
Conc<Byte>,
|
142
142
|
unknown,
|
@@ -162,37 +162,37 @@ export function createWriteSink<InErr>(
|
|
162
162
|
}
|
163
163
|
|
164
164
|
export function fchmod(fd: FileDescriptor, mode: fs.Mode): FIO<ErrnoException, void> {
|
165
|
-
return IO.async<
|
165
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
166
166
|
fs.fchmod(FileDescriptor.reverseGet(fd), mode, unitErrorCallback(cb));
|
167
167
|
});
|
168
168
|
}
|
169
169
|
|
170
170
|
export function fchown(fd: FileDescriptor, uid: number, gid: number): FIO<ErrnoException, void> {
|
171
|
-
return IO.async<
|
171
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
172
172
|
fs.fchown(FileDescriptor.reverseGet(fd), uid, gid, unitErrorCallback(cb));
|
173
173
|
});
|
174
174
|
}
|
175
175
|
|
176
176
|
export function fdatasync(fd: FileDescriptor): FIO<ErrnoException, void> {
|
177
|
-
return IO.async<
|
177
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
178
178
|
fs.fdatasync(FileDescriptor.reverseGet(fd), unitErrorCallback(cb));
|
179
179
|
});
|
180
180
|
}
|
181
181
|
|
182
182
|
export function fstat(fd: FileDescriptor): FIO<ErrnoException, fs.Stats> {
|
183
|
-
return IO.async<
|
183
|
+
return IO.async<never, ErrnoException, fs.Stats>((cb) => {
|
184
184
|
fs.fstat(FileDescriptor.reverseGet(fd), (err, stats) => (err ? cb(IO.fail(err)) : cb(IO.succeedNow(stats))));
|
185
185
|
});
|
186
186
|
}
|
187
187
|
|
188
188
|
export function fsync(fd: FileDescriptor): FIO<ErrnoException, void> {
|
189
|
-
return IO.async<
|
189
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
190
190
|
fs.fsync(FileDescriptor.reverseGet(fd), unitErrorCallback(cb));
|
191
191
|
});
|
192
192
|
}
|
193
193
|
|
194
194
|
export function ftruncate(fd: FileDescriptor, len: number): FIO<ErrnoException, void> {
|
195
|
-
return IO.async<
|
195
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
196
196
|
fs.ftruncate(FileDescriptor.reverseGet(fd), len, unitErrorCallback(cb));
|
197
197
|
});
|
198
198
|
}
|
@@ -202,19 +202,19 @@ export function futimes(
|
|
202
202
|
atime: string | number | Date,
|
203
203
|
mtime: string | number | Date,
|
204
204
|
): FIO<ErrnoException, void> {
|
205
|
-
return IO.async<
|
205
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
206
206
|
fs.futimes(FileDescriptor.reverseGet(fd), atime, mtime, unitErrorCallback(cb));
|
207
207
|
});
|
208
208
|
}
|
209
209
|
|
210
210
|
export function lchmod(path: fs.PathLike, mode: fs.Mode): FIO<ErrnoException, void> {
|
211
|
-
return IO.async<
|
211
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
212
212
|
fs.lchmod(path, mode, unitErrorCallback(cb));
|
213
213
|
});
|
214
214
|
}
|
215
215
|
|
216
216
|
export function lchown(path: fs.PathLike, uid: number, gid: number): FIO<ErrnoException, void> {
|
217
|
-
return IO.async<
|
217
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
218
218
|
fs.lchown(path, uid, gid, unitErrorCallback(cb));
|
219
219
|
});
|
220
220
|
}
|
@@ -224,19 +224,19 @@ export function lutimes(
|
|
224
224
|
atime: string | number | Date,
|
225
225
|
mtime: string | number | Date,
|
226
226
|
): FIO<ErrnoException, void> {
|
227
|
-
return IO.async<
|
227
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
228
228
|
fs.lutimes(path, atime, mtime, unitErrorCallback(cb));
|
229
229
|
});
|
230
230
|
}
|
231
231
|
|
232
232
|
export function link(path: fs.PathLike, newPath: fs.PathLike): FIO<ErrnoException, void> {
|
233
|
-
return IO.async<
|
233
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
234
234
|
fs.link(path, newPath, (err) => (err ? cb(IO.fail(err)) : cb(IO.unit)));
|
235
235
|
});
|
236
236
|
}
|
237
237
|
|
238
238
|
export function lstat(path: fs.PathLike): FIO<ErrnoException, fs.Stats> {
|
239
|
-
return IO.async<
|
239
|
+
return IO.async<never, ErrnoException, fs.Stats>((cb) => {
|
240
240
|
fs.lstat(path, (err, stats) => (err ? cb(IO.fail(err)) : cb(IO.succeedNow(stats))));
|
241
241
|
});
|
242
242
|
}
|
@@ -245,13 +245,13 @@ export function mkdir(
|
|
245
245
|
path: fs.PathLike,
|
246
246
|
options?: { recursive?: boolean; mode?: fs.Mode },
|
247
247
|
): FIO<ErrnoException, Maybe<string>> {
|
248
|
-
return IO.async<
|
248
|
+
return IO.async<never, ErrnoException, Maybe<string>>((cb) => {
|
249
249
|
fs.mkdir(path, options, (err, path) => (err ? cb(IO.fail(err)) : cb(IO.succeed(Maybe.fromNullable(path)))));
|
250
250
|
});
|
251
251
|
}
|
252
252
|
|
253
253
|
export function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding }): FIO<ErrnoException, string> {
|
254
|
-
return IO.async<
|
254
|
+
return IO.async<never, ErrnoException, string>((cb) => {
|
255
255
|
fs.mkdtemp(prefix, options, (err, folder) => (err ? cb(IO.failNow(err)) : cb(IO.succeedNow(folder))));
|
256
256
|
});
|
257
257
|
}
|
@@ -261,7 +261,7 @@ export function open(
|
|
261
261
|
flags: fs.OpenMode,
|
262
262
|
mode?: string | number,
|
263
263
|
): FIO<NodeJS.ErrnoException, FileDescriptor> {
|
264
|
-
return IO.async<
|
264
|
+
return IO.async<never, ErrnoException, FileDescriptor>((cb) => {
|
265
265
|
fs.open(path, flags, mode ?? null, (err, fd) => (err ? cb(IO.fail(err)) : cb(IO.succeed(FileDescriptor.get(fd)))));
|
266
266
|
});
|
267
267
|
}
|
@@ -275,20 +275,20 @@ export class Dir {
|
|
275
275
|
}
|
276
276
|
|
277
277
|
close(): FIO<ErrnoException, void> {
|
278
|
-
return IO.async<
|
278
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
279
279
|
this._dir.close(unitErrorCallback(cb));
|
280
280
|
});
|
281
281
|
}
|
282
282
|
|
283
283
|
read(): FIO<ErrnoException, Maybe<fs.Dirent>> {
|
284
|
-
return IO.async<
|
284
|
+
return IO.async<never, ErrnoException, Maybe<fs.Dirent>>((cb) => {
|
285
285
|
this._dir.read((err, dirEnt) => (err ? cb(IO.fail(err)) : cb(IO.succeedNow(Maybe.fromNullable(dirEnt)))));
|
286
286
|
});
|
287
287
|
}
|
288
288
|
}
|
289
289
|
|
290
290
|
export function opendir(path: fs.PathLike, options?: fs.OpenDirOptions): FIO<ErrnoException, Dir> {
|
291
|
-
return IO.async<
|
291
|
+
return IO.async<never, ErrnoException, Dir>((cb) => {
|
292
292
|
fs.opendir(path as any, options ?? {}, (err, dir) => (err ? cb(IO.fail(err)) : cb(IO.succeedNow(new Dir(dir)))));
|
293
293
|
});
|
294
294
|
}
|
@@ -298,7 +298,7 @@ export function read(
|
|
298
298
|
length: number,
|
299
299
|
position?: number,
|
300
300
|
): FIO<ErrnoException, readonly [number, Buffer]> {
|
301
|
-
return IO.async<
|
301
|
+
return IO.async<never, ErrnoException, readonly [number, Buffer]>((cb) => {
|
302
302
|
const buf = Buffer.alloc(length);
|
303
303
|
fs.read(FileDescriptor.reverseGet(fd), buf, 0, length, position ?? null, (err, bytesRead, buffer) =>
|
304
304
|
err ? cb(IO.fail(err)) : cb(IO.succeed([bytesRead, buffer])),
|
@@ -372,7 +372,7 @@ export function realpath(
|
|
372
372
|
},
|
373
373
|
): FIO<ErrnoException, Buffer>;
|
374
374
|
export function realpath(path: fs.PathLike, options?: any): FIO<ErrnoException, any> {
|
375
|
-
return IO.async<
|
375
|
+
return IO.async<never, ErrnoException, any>((cb) => {
|
376
376
|
fs.realpath(path, options ?? {}, (err, resolvedPath) => (err ? cb(IO.fail(err)) : cb(IO.succeedNow(resolvedPath))));
|
377
377
|
});
|
378
378
|
}
|
@@ -390,7 +390,7 @@ export function realpathNative(
|
|
390
390
|
},
|
391
391
|
): FIO<ErrnoException, Buffer>;
|
392
392
|
export function realpathNative(path: fs.PathLike, options?: any): FIO<ErrnoException, any> {
|
393
|
-
return IO.async<
|
393
|
+
return IO.async<never, ErrnoException, any>((cb) => {
|
394
394
|
fs.realpath.native(path, options ?? {}, (err, resolvedPath) =>
|
395
395
|
err ? cb(IO.fail(err)) : cb(IO.succeed(resolvedPath)),
|
396
396
|
);
|
@@ -398,19 +398,19 @@ export function realpathNative(path: fs.PathLike, options?: any): FIO<ErrnoExcep
|
|
398
398
|
}
|
399
399
|
|
400
400
|
export function rename(oldPath: fs.PathLike, newPath: fs.PathLike): FIO<ErrnoException, void> {
|
401
|
-
return IO.async<
|
401
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
402
402
|
fs.rename(oldPath, newPath, unitErrorCallback(cb));
|
403
403
|
});
|
404
404
|
}
|
405
405
|
|
406
406
|
export function rm(path: fs.PathLike, options?: fs.RmOptions): FIO<ErrnoException, void> {
|
407
|
-
return IO.async<
|
407
|
+
return IO.async<never, NodeJS.ErrnoException, void>((cb) => {
|
408
408
|
fs.rm(path, options ?? {}, unitErrorCallback(cb));
|
409
409
|
});
|
410
410
|
}
|
411
411
|
|
412
412
|
export function rmdir(path: fs.PathLike, options?: fs.RmDirOptions): FIO<ErrnoException, void> {
|
413
|
-
return IO.async<
|
413
|
+
return IO.async<never, NodeJS.ErrnoException, void>((cb) => {
|
414
414
|
fs.rmdir(path, options ?? {}, unitErrorCallback(cb));
|
415
415
|
});
|
416
416
|
}
|
@@ -421,25 +421,25 @@ export function stat(
|
|
421
421
|
path: fs.PathLike,
|
422
422
|
options?: { bigint?: boolean },
|
423
423
|
): FIO<ErrnoException, fs.Stats | fs.BigIntStats> {
|
424
|
-
return IO.async<
|
424
|
+
return IO.async<never, ErrnoException, fs.Stats | fs.BigIntStats>((cb) => {
|
425
425
|
fs.stat(path, options ?? ({} as any), (err, stats) => (err ? cb(IO.fail(err)) : cb(IO.succeedNow(stats))));
|
426
426
|
});
|
427
427
|
}
|
428
428
|
|
429
429
|
export function symlink(target: fs.PathLike, path: fs.PathLike): FIO<ErrnoException, void> {
|
430
|
-
return IO.async<
|
430
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
431
431
|
fs.symlink(target, path, unitErrorCallback(cb));
|
432
432
|
});
|
433
433
|
}
|
434
434
|
|
435
435
|
export function truncate(path: fs.PathLike, len?: number): FIO<ErrnoException, void> {
|
436
|
-
return IO.async<
|
436
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
437
437
|
fs.truncate(path, len, unitErrorCallback(cb));
|
438
438
|
});
|
439
439
|
}
|
440
440
|
|
441
441
|
export function unlink(path: fs.PathLike): FIO<ErrnoException, void> {
|
442
|
-
return IO.async<
|
442
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
443
443
|
fs.unlink(path, unitErrorCallback(cb));
|
444
444
|
});
|
445
445
|
}
|
@@ -449,13 +449,13 @@ export function utimes(
|
|
449
449
|
atime: string | number | Date,
|
450
450
|
mtime: string | number | Date,
|
451
451
|
): FIO<ErrnoException, void> {
|
452
|
-
return IO.async<
|
452
|
+
return IO.async<never, ErrnoException, void>((cb) => {
|
453
453
|
fs.utimes(path, atime, mtime, unitErrorCallback(cb));
|
454
454
|
});
|
455
455
|
}
|
456
456
|
|
457
457
|
export function write(fd: FileDescriptor, buffer: Conc<Byte>, position?: number): FIO<ErrnoException, number> {
|
458
|
-
return IO.async<
|
458
|
+
return IO.async<never, ErrnoException, number>((cb) => {
|
459
459
|
const b = buffer.toBuffer;
|
460
460
|
fs.write(FileDescriptor.reverseGet(fd), b, position ?? null, b.byteLength, (err, bytesWritten) =>
|
461
461
|
err ? cb(IO.failNow(err)) : cb(IO.succeedNow(bytesWritten)),
|
@@ -473,7 +473,7 @@ export function writeFile(
|
|
473
473
|
file: fs.PathOrFileDescriptor,
|
474
474
|
data: string | NodeJS.ArrayBufferView,
|
475
475
|
options: WriteFileOptions = {},
|
476
|
-
): IO<
|
476
|
+
): IO<never, ErrnoException, void> {
|
477
477
|
return IO.asyncInterrupt((cb) => {
|
478
478
|
const abortController = new AbortController();
|
479
479
|
fs.writeFile(file, data, { ...options, signal: abortController.signal }, (err) =>
|
@@ -488,7 +488,7 @@ export function writev(
|
|
488
488
|
buffers: ReadonlyArray<Uint8Array>,
|
489
489
|
position?: number,
|
490
490
|
): FIO<ErrnoException, number> {
|
491
|
-
return IO.async<
|
491
|
+
return IO.async<never, ErrnoException, number>((cb) => {
|
492
492
|
if (position) {
|
493
493
|
fs.writev(FileDescriptor.reverseGet(fd), buffers, position, (err, bytesWritten) =>
|
494
494
|
err ? cb(IO.fail(err)) : cb(IO.succeedNow(bytesWritten)),
|
@@ -508,7 +508,7 @@ export function watch(
|
|
508
508
|
recursive?: boolean;
|
509
509
|
encoding: "buffer";
|
510
510
|
},
|
511
|
-
): Stream<
|
511
|
+
): Stream<never, Error, { eventType: "rename" | "change"; filename: Buffer }>;
|
512
512
|
export function watch(
|
513
513
|
filename: fs.PathLike,
|
514
514
|
options?: {
|
@@ -516,11 +516,11 @@ export function watch(
|
|
516
516
|
recursive?: boolean;
|
517
517
|
encoding?: BufferEncoding;
|
518
518
|
},
|
519
|
-
): Stream<
|
519
|
+
): Stream<never, Error, { eventType: "rename" | "change"; filename: string }>;
|
520
520
|
export function watch(
|
521
521
|
filename: fs.PathLike,
|
522
522
|
options?: any,
|
523
|
-
): Stream<
|
523
|
+
): Stream<never, Error, { eventType: "rename" | "change"; filename: string | Buffer }> {
|
524
524
|
return Stream.fromIO(
|
525
525
|
IO.tryCatch(
|
526
526
|
() => fs.watch(filename, options ?? {}),
|
@@ -528,7 +528,7 @@ export function watch(
|
|
528
528
|
),
|
529
529
|
).flatMap((watcher) =>
|
530
530
|
Stream.repeatIOMaybe(
|
531
|
-
IO.async<
|
531
|
+
IO.async<never, Maybe<Error>, { eventType: "rename" | "change"; filename: string | Buffer }>((cb) => {
|
532
532
|
watcher.once("change", (eventType, filename) => {
|
533
533
|
watcher.removeAllListeners();
|
534
534
|
cb(IO.succeedNow({ eventType: eventType as any, filename }));
|
@@ -553,7 +553,7 @@ export function watchFile(
|
|
553
553
|
persistent?: boolean;
|
554
554
|
interval?: number;
|
555
555
|
},
|
556
|
-
): Stream<
|
556
|
+
): Stream<never, never, [fs.BigIntStats, fs.BigIntStats]>;
|
557
557
|
export function watchFile(
|
558
558
|
filename: fs.PathLike,
|
559
559
|
options?: {
|
@@ -561,15 +561,15 @@ export function watchFile(
|
|
561
561
|
persistent?: boolean;
|
562
562
|
interval?: number;
|
563
563
|
},
|
564
|
-
): Stream<
|
564
|
+
): Stream<never, never, [fs.Stats, fs.Stats]>;
|
565
565
|
export function watchFile(
|
566
566
|
filename: fs.PathLike,
|
567
567
|
options?: any,
|
568
|
-
): Stream<
|
568
|
+
): Stream<never, never, [fs.BigIntStats | fs.Stats, fs.BigIntStats | fs.Stats]> {
|
569
569
|
return Stream.acquireRelease(
|
570
570
|
Do((_) => {
|
571
571
|
const queue = _(Queue.makeUnbounded<[fs.BigIntStats | fs.Stats, fs.BigIntStats | fs.Stats]>());
|
572
|
-
const runtime = _(IO.runtime<
|
572
|
+
const runtime = _(IO.runtime<never>());
|
573
573
|
fs.watchFile(filename, options ?? {}, (curr, prev) => {
|
574
574
|
runtime.unsafeRunAsync(queue.offer([curr, prev]));
|
575
575
|
});
|
package/fs/api.d.ts
CHANGED
@@ -13,13 +13,13 @@ import { Channel } from "@fncts/io/Channel";
|
|
13
13
|
import * as fs from "fs";
|
14
14
|
declare type ErrnoException = NodeJS.ErrnoException;
|
15
15
|
interface FileDescriptorN extends HKT {
|
16
|
-
|
16
|
+
type: FileDescriptor;
|
17
17
|
}
|
18
18
|
export interface FileDescriptor extends Newtype<{
|
19
19
|
readonly FileDescriptor: unique symbol;
|
20
20
|
}, number> {
|
21
21
|
}
|
22
|
-
export declare const FileDescriptor: import("@fncts/base/data/Newtype").NewtypeIso<FileDescriptorN>;
|
22
|
+
export declare const FileDescriptor: import("@fncts/base/data/Newtype").NewtypeIso<FileDescriptorN, import("@fncts/typelevel/HKT").HKT.None>;
|
23
23
|
export declare function access(path: fs.PathLike, mode: number | undefined): FIO<ErrnoException, void>;
|
24
24
|
export declare function appendFile(path: fs.PathLike | FileDescriptor, data: string | Buffer, options?: fs.WriteFileOptions): FIO<ErrnoException, void>;
|
25
25
|
export declare function chmod(path: fs.PathLike, mode: fs.Mode): FIO<ErrnoException, void>;
|
@@ -33,13 +33,13 @@ interface CreateReadStreamOptions {
|
|
33
33
|
start?: number;
|
34
34
|
end?: number;
|
35
35
|
}
|
36
|
-
export declare function createReadStream(path: fs.PathLike, options?: CreateReadStreamOptions): Stream<
|
36
|
+
export declare function createReadStream(path: fs.PathLike, options?: CreateReadStreamOptions): Stream<never, ErrnoException, Byte>;
|
37
37
|
interface CreateWriteSinkOptions {
|
38
38
|
flags?: fs.OpenMode;
|
39
39
|
mode?: string | number;
|
40
40
|
start?: number;
|
41
41
|
}
|
42
|
-
export declare function createWriteSink<InErr>(path: fs.PathLike, options?: CreateWriteSinkOptions): Sink<
|
42
|
+
export declare function createWriteSink<InErr>(path: fs.PathLike, options?: CreateWriteSinkOptions): Sink<never, InErr | ErrnoException, Byte, never, void>;
|
43
43
|
export declare function fchmod(fd: FileDescriptor, mode: fs.Mode): FIO<ErrnoException, void>;
|
44
44
|
export declare function fchown(fd: FileDescriptor, uid: number, gid: number): FIO<ErrnoException, void>;
|
45
45
|
export declare function fdatasync(fd: FileDescriptor): FIO<ErrnoException, void>;
|
@@ -119,13 +119,13 @@ export interface WriteFileOptions {
|
|
119
119
|
readonly mode?: fs.Mode;
|
120
120
|
readonly flag?: string;
|
121
121
|
}
|
122
|
-
export declare function writeFile(file: fs.PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): IO<
|
122
|
+
export declare function writeFile(file: fs.PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): IO<never, ErrnoException, void>;
|
123
123
|
export declare function writev(fd: FileDescriptor, buffers: ReadonlyArray<Uint8Array>, position?: number): FIO<ErrnoException, number>;
|
124
124
|
export declare function watch(filename: fs.PathLike, options: {
|
125
125
|
persistent?: boolean;
|
126
126
|
recursive?: boolean;
|
127
127
|
encoding: "buffer";
|
128
|
-
}): Stream<
|
128
|
+
}): Stream<never, Error, {
|
129
129
|
eventType: "rename" | "change";
|
130
130
|
filename: Buffer;
|
131
131
|
}>;
|
@@ -133,7 +133,7 @@ export declare function watch(filename: fs.PathLike, options?: {
|
|
133
133
|
persistent?: boolean;
|
134
134
|
recursive?: boolean;
|
135
135
|
encoding?: BufferEncoding;
|
136
|
-
}): Stream<
|
136
|
+
}): Stream<never, Error, {
|
137
137
|
eventType: "rename" | "change";
|
138
138
|
filename: string;
|
139
139
|
}>;
|
@@ -141,10 +141,10 @@ export declare function watchFile(filename: fs.PathLike, options: {
|
|
141
141
|
bigint: true;
|
142
142
|
persistent?: boolean;
|
143
143
|
interval?: number;
|
144
|
-
}): Stream<
|
144
|
+
}): Stream<never, never, [fs.BigIntStats, fs.BigIntStats]>;
|
145
145
|
export declare function watchFile(filename: fs.PathLike, options?: {
|
146
146
|
bigint?: false;
|
147
147
|
persistent?: boolean;
|
148
148
|
interval?: number;
|
149
|
-
}): Stream<
|
149
|
+
}): Stream<never, never, [fs.Stats, fs.Stats]>;
|
150
150
|
export {};
|