-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
file-system.mts
62 lines (57 loc) · 1.4 KB
/
file-system.mts
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* @file Interfaces - FileSystem
* @module mlly/interfaces/FileSystem
*/
import type { Awaitable, ModuleId, Stats } from '@flex-development/mlly'
/**
* File system API.
*/
interface FileSystem {
/**
* Get the contents of `id`.
*
* @see {@linkcode Awaitable}
* @see {@linkcode Buffer}
* @see {@linkcode ModuleId}
* @see https://nodejs.org/api/fs.html#fsreadfilepath-options-callback
*
* @this {void}
*
* @param {ModuleId} id
* The path or `file:` URL to handle
* @return {Awaitable<Buffer | string>}
* File contents
*/
readFile(this: void, id: ModuleId): Awaitable<Buffer | string>
/**
* Get the resolved pathname for `id`.
*
* @see {@linkcode Awaitable}
* @see {@linkcode ModuleId}
* @see https://nodejs.org/api/fs.html#fsrealpathpath-options-callback
*
* @this {void}
*
* @param {ModuleId} id
* The path or `file:` URL to handle
* @return {Awaitable<string>}
* Resolved pathname
*/
realpath(this: void, id: ModuleId): Awaitable<string>
/**
* Get information about a directory or file.
*
* @see {@linkcode Awaitable}
* @see {@linkcode ModuleId}
* @see {@linkcode Stats}
*
* @this {void}
*
* @param {ModuleId} id
* The path or `file:` URL to handle
* @return {Awaitable<Stats>}
* Info about `id`
*/
stat(this: void, id: ModuleId): Awaitable<Stats>
}
export type { FileSystem as default }