crash-js 0.1.119 → 0.1.120
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/crash-js/fs-utils +30 -21
- package/package.json +1 -1
package/crash-js/fs-utils
CHANGED
|
@@ -38,6 +38,30 @@ const
|
|
|
38
38
|
_fs_module =
|
|
39
39
|
require(
|
|
40
40
|
"fs");
|
|
41
|
+
const
|
|
42
|
+
_fs_read_dir_sync_type =
|
|
43
|
+
typeof(
|
|
44
|
+
_fs.readdirSync);
|
|
45
|
+
if ( _fs_read_dir_sync_type === 'undefined' ) {
|
|
46
|
+
_fs_read_dir_sync =
|
|
47
|
+
_fs.readDirSync;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
_fs_read_dir_sync =
|
|
51
|
+
_fs.readdirSync;
|
|
52
|
+
}
|
|
53
|
+
const
|
|
54
|
+
_fs_exists_sync =
|
|
55
|
+
_fs.existsSync;
|
|
56
|
+
const
|
|
57
|
+
_fs_append_file_sync =
|
|
58
|
+
_fs.appendFileSync;
|
|
59
|
+
const
|
|
60
|
+
_fs_read_file_sync =
|
|
61
|
+
_fs.readFileSync;
|
|
62
|
+
const
|
|
63
|
+
_fs_write_file_sync =
|
|
64
|
+
_fs.writeFileSync;
|
|
41
65
|
const
|
|
42
66
|
_fs_worker_new =
|
|
43
67
|
_fs_module.fsWorkerNew;
|
|
@@ -124,7 +148,7 @@ function
|
|
|
124
148
|
_return =
|
|
125
149
|
false;
|
|
126
150
|
_exists =
|
|
127
|
-
|
|
151
|
+
_fs_exists_sync(
|
|
128
152
|
_path);
|
|
129
153
|
if (_exists) {
|
|
130
154
|
_return =
|
|
@@ -145,7 +169,7 @@ function
|
|
|
145
169
|
"flag":
|
|
146
170
|
'r'};
|
|
147
171
|
_return =
|
|
148
|
-
|
|
172
|
+
_fs_read_file_sync(
|
|
149
173
|
_path,
|
|
150
174
|
_read_opts);
|
|
151
175
|
return _return;
|
|
@@ -156,7 +180,7 @@ function
|
|
|
156
180
|
_path,
|
|
157
181
|
_content,
|
|
158
182
|
_append) {
|
|
159
|
-
|
|
183
|
+
_fs_append_file_sync(
|
|
160
184
|
_path,
|
|
161
185
|
_content);
|
|
162
186
|
}
|
|
@@ -166,7 +190,7 @@ function
|
|
|
166
190
|
_path,
|
|
167
191
|
_content,
|
|
168
192
|
_append) {
|
|
169
|
-
|
|
193
|
+
_fs_write_file_sync(
|
|
170
194
|
_path,
|
|
171
195
|
_content);
|
|
172
196
|
}
|
|
@@ -189,26 +213,11 @@ function
|
|
|
189
213
|
function
|
|
190
214
|
_ls(
|
|
191
215
|
_args) {
|
|
192
|
-
|
|
193
|
-
_read_dir,
|
|
194
|
-
_return;
|
|
195
|
-
if ( typeof(
|
|
196
|
-
_fs.readdirSync) === 'undefined' ) {
|
|
197
|
-
_read_dir =
|
|
198
|
-
_fs.readDirSync;
|
|
199
|
-
_return =
|
|
200
|
-
_read_dir.apply(
|
|
201
|
-
null,
|
|
202
|
-
[_args]).unwrap()
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
_read_dir =
|
|
206
|
-
_fs.readdirSync;
|
|
216
|
+
const
|
|
207
217
|
_return =
|
|
208
|
-
|
|
218
|
+
_fs_read_dir_sync.apply(
|
|
209
219
|
null,
|
|
210
220
|
[_args]);
|
|
211
|
-
}
|
|
212
221
|
return _return;
|
|
213
222
|
}
|
|
214
223
|
|