|
1 | | -import type {BigIntStats, ReadStream, StatOptions, Stats, WriteStream, WriteVResult} from 'fs'; |
2 | | -import {createInterface} from 'readline'; |
3 | | - |
4 | | -import type {CreateReadStreamOptions, CreateWriteStreamOptions, FakeFS} from '../FakeFS'; |
5 | | -import type {Path} from '../path'; |
6 | | - |
7 | | -// Types copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/9e2e5af93f9cc2cf434a96e3249a573100e87351/types/node/v16 |
8 | | -// Implementation based on https://github.com/nodejs/node/blob/10493b48c7edb227c13a493d0a2c75efe878d7e9/lib/internal/fs/promises.js#L124-L336 |
9 | | - |
10 | | -interface ObjectEncodingOptions { |
11 | | - encoding?: BufferEncoding | null | undefined; |
12 | | -} |
13 | | - |
14 | | -interface FlagAndOpenMode { |
15 | | - mode?: Mode | undefined; |
16 | | - flag?: OpenMode | undefined; |
17 | | -} |
18 | | - |
19 | | -type OpenMode = number | string; |
20 | | -type Mode = number | string; |
21 | | - |
22 | | -interface FileReadResult<T extends ArrayBufferView> { |
23 | | - bytesRead: number; |
24 | | - buffer: T; |
25 | | -} |
26 | | - |
27 | | -interface FileReadOptions<T extends ArrayBufferView = Buffer> { |
28 | | - buffer?: T; |
29 | | - offset?: number | null; |
30 | | - length?: number | null; |
31 | | - position?: number | null; |
32 | | -} |
33 | | - |
34 | | -interface ReadVResult { |
35 | | - bytesRead: number; |
36 | | - buffers: Array<NodeJS.ArrayBufferView>; |
37 | | -} |
38 | | - |
39 | | -interface AbortSignal { |
40 | | - readonly aborted: boolean; |
41 | | -} |
42 | | - |
43 | | -interface Abortable { |
44 | | - signal?: AbortSignal | undefined; |
45 | | -} |
46 | | - |
| 1 | +import type {Abortable} from 'events'; |
| 2 | +import type {FlagAndOpenMode, FileReadResult, FileReadOptions} from 'fs/promises'; |
| 3 | +import {createInterface} from 'readline'; |
| 4 | + |
| 5 | +import type {CreateReadStreamOptions, CreateWriteStreamOptions, FakeFS} from '../FakeFS'; |
| 6 | +import type {Path} from '../path'; |
| 7 | + |
| 8 | +import type { |
| 9 | + BigIntStats, |
| 10 | + ObjectEncodingOptions, |
| 11 | + OpenMode, |
| 12 | + ReadStream, |
| 13 | + ReadVResult, |
| 14 | + StatOptions, |
| 15 | + Stats, |
| 16 | + WriteStream, |
| 17 | + WriteVResult, |
| 18 | +} from 'fs'; |
47 | 19 |
|
48 | 20 | type WriteArgsBuffer<TBuffer extends Uint8Array> = [ |
49 | 21 | buffer: TBuffer, |
|
0 commit comments