Skip to content
File

Blob: src/node/fs.ts

typescript193 lines
1// Copyright (c) 2017-2022 Cloudflare, Inc.
2// Licensed under the Apache 2.0 license found in the LICENSE file or at:
3// https://opensource.org/licenses/Apache-2.0
4 
5import * as promises from 'node-internal:internal_fs_promises';
6import * as constants from 'node-internal:internal_fs_constants';
7import * as callbackMethods from 'node-internal:internal_fs_callback';
8import { Dirent, Dir } from 'node-internal:internal_fs';
9import { Stats } from 'node-internal:internal_fs_utils';
10 
11export * from 'node-internal:internal_fs_callback';
12import {
13 ReadStream,
14 WriteStream,
15 createReadStream,
16 createWriteStream,
17} from 'node-internal:internal_fs_streams';
18import {
19 accessSync,
20 existsSync,
21 appendFileSync,
22 chmodSync,
23 chownSync,
24 closeSync,
25 copyFileSync,
26 cpSync,
27 fchmodSync,
28 fchownSync,
29 fdatasyncSync,
30 fstatSync,
31 fsyncSync,
32 ftruncateSync,
33 futimesSync,
34 globSync,
35 lchmodSync,
36 lchownSync,
37 lutimesSync,
38 linkSync,
39 lstatSync,
40 mkdirSync,
41 mkdtempSync,
42 opendirSync,
43 openSync,
44 readdirSync,
45 readFileSync,
46 readlinkSync,
47 readSync,
48 readvSync,
49 realpathSync,
50 renameSync,
51 rmdirSync,
52 rmSync,
53 statSync,
54 statfsSync,
55 symlinkSync,
56 truncateSync,
57 unlinkSync,
58 utimesSync,
59 writeFileSync,
60 writeSync,
61 writevSync,
62 openAsBlob,
63} from 'node-internal:internal_fs_sync';
64 
65const { F_OK, R_OK, W_OK, X_OK } = constants;
66 
67// Node.js exports these as aliases
68export const FileWriteStream = WriteStream;
69export const FileReadStream = ReadStream;
70 
71export {
72 constants,
73 F_OK,
74 R_OK,
75 W_OK,
76 X_OK,
77 promises,
78 Dirent,
79 Dir,
80 accessSync,
81 existsSync,
82 appendFileSync,
83 chmodSync,
84 chownSync,
85 closeSync,
86 copyFileSync,
87 cpSync,
88 fchmodSync,
89 fchownSync,
90 fdatasyncSync,
91 fstatSync,
92 fsyncSync,
93 ftruncateSync,
94 futimesSync,
95 globSync,
96 lchmodSync,
97 lchownSync,
98 lutimesSync,
99 linkSync,
100 lstatSync,
101 mkdirSync,
102 mkdtempSync,
103 opendirSync,
104 openSync,
105 readdirSync,
106 readFileSync,
107 readlinkSync,
108 readSync,
109 readvSync,
110 realpathSync,
111 renameSync,
112 rmdirSync,
113 rmSync,
114 statSync,
115 statfsSync,
116 symlinkSync,
117 truncateSync,
118 unlinkSync,
119 utimesSync,
120 writeFileSync,
121 writeSync,
122 writevSync,
123 Stats,
124 ReadStream,
125 WriteStream,
126 createReadStream,
127 createWriteStream,
128 openAsBlob,
129};
130 
131export default {
132 constants,
133 F_OK,
134 R_OK,
135 W_OK,
136 X_OK,
137 promises,
138 Dirent,
139 Dir,
140 Stats,
141 ...callbackMethods,
142 accessSync,
143 existsSync,
144 appendFileSync,
145 chmodSync,
146 chownSync,
147 closeSync,
148 copyFileSync,
149 cpSync,
150 fchmodSync,
151 fchownSync,
152 fdatasyncSync,
153 fstatSync,
154 fsyncSync,
155 ftruncateSync,
156 futimesSync,
157 globSync,
158 lchmodSync,
159 lchownSync,
160 lutimesSync,
161 linkSync,
162 lstatSync,
163 mkdirSync,
164 mkdtempSync,
165 opendirSync,
166 openSync,
167 readdirSync,
168 readFileSync,
169 readlinkSync,
170 readSync,
171 readvSync,
172 realpathSync,
173 renameSync,
174 rmdirSync,
175 rmSync,
176 statSync,
177 statfsSync,
178 symlinkSync,
179 truncateSync,
180 unlinkSync,
181 utimesSync,
182 writeFileSync,
183 writeSync,
184 writevSync,
185 WriteStream,
186 ReadStream,
187 FileWriteStream,
188 FileReadStream,
189 createReadStream,
190 createWriteStream,
191 openAsBlob,
192};