encoding-tools 0.0.10 → 0.0.11

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/encoding-tools CHANGED
@@ -36,6 +36,9 @@ const
36
36
  _txt2bin_module =
37
37
  require(
38
38
  "./libtxt2bin");
39
+ const
40
+ _input_texts_check =
41
+ _txt2bin_module._input_texts_check;
39
42
  const
40
43
  _txt2bin =
41
44
  _txt2bin_module._txt2bin;
@@ -43,6 +46,8 @@ const
43
46
  module.exports = {
44
47
  _bin2txt:
45
48
  _bin2txt,
49
+ _input_texts_check:
50
+ _input_texts_check,
46
51
  _txt2bin:
47
52
  _txt2bin
48
53
  };
package/libtxt2bin CHANGED
@@ -88,6 +88,11 @@ const
88
88
  const
89
89
  _file_append =
90
90
  _libcrash._file_append;
91
+ /* global
92
+ _file_exists */
93
+ const
94
+ _file_exists =
95
+ _libcrash._file_exists;
91
96
  /* global
92
97
  _file_read */
93
98
  const
@@ -179,7 +184,7 @@ async function
179
184
  _msg);
180
185
  }
181
186
 
182
- function
187
+ async function
183
188
  _base64_decode(
184
189
  _output_file,
185
190
  _input_files,
@@ -202,9 +207,14 @@ function
202
207
  _input_files[
203
208
  0];
204
209
  if ( 0 < _input_files.length ) {
210
+ const
211
+ _tmp_dir =
212
+ await _mktemp();
213
+ console.log(
214
+ _tmp_dir);
205
215
  _txt =
206
216
  _path_join( [
207
- _mktemp(),
217
+ _tmp_dir,
208
218
  "merge.base64" ]);
209
219
  _assemble(
210
220
  _txt,
@@ -222,11 +232,48 @@ function
222
232
  }
223
233
 
224
234
  function
235
+ _input_texts_check(
236
+ _input_texts) {
237
+ let
238
+ _file,
239
+ _input_file_exists;
240
+ for ( _file of _input_texts ) {
241
+ _input_file_exists =
242
+ _file_exists(
243
+ _file);
244
+ if ( ! _input_file_exists ) {
245
+ const
246
+ _msg =
247
+ `Input file '${_file}' does not ` +
248
+ `exist.`;
249
+ _msg_error(
250
+ _msg,
251
+ 1);
252
+ }
253
+ }
254
+ }
255
+
256
+ async function
225
257
  _txt2bin(
226
258
  _output_file,
227
259
  _encoding_format,
228
260
  _argument_type,
229
- _input_files) {
261
+ _input_files,
262
+ _input_files_sanity_check) {
263
+ const
264
+ _input_files_sanity_check_type =
265
+ typeof(
266
+ _input_files_sanity_check);
267
+ if ( _input_files_sanity_check_type == "undefined" ||
268
+ _input_files_sanity_check == "" ||
269
+ _input_files_sanity_check == "true" ) {
270
+ _input_files_sanity_check =
271
+ true;
272
+ }
273
+ if ( _input_files_sanity_check == "false" ) {
274
+ _input_files_sanity_check =
275
+ false;
276
+ }
230
277
  if ( _argument_type == "list" ) {
231
278
  const
232
279
  _list =
@@ -237,8 +284,12 @@ function
237
284
  _list).split(
238
285
  "\n");
239
286
  }
287
+ if ( _input_files_sanity_check ) {
288
+ _input_texts_check(
289
+ _input_files);
290
+ }
240
291
  if ( _encoding_format == "base64" ) {
241
- _base64_decode(
292
+ await _base64_decode(
242
293
  _output_file,
243
294
  _input_files,
244
295
  _argument_type);
@@ -246,6 +297,8 @@ function
246
297
  }
247
298
 
248
299
  module.exports = {
300
+ _input_texts_check:
301
+ _input_texts_check,
249
302
  _txt2bin:
250
303
  _txt2bin
251
304
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name":
3
3
  "encoding-tools",
4
4
  "version":
5
- "0.0.10",
5
+ "0.0.11",
6
6
  "description":
7
7
  "A multi-language collection of encoding tools.",
8
8
  "funding": {
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "crash-js-webpack":
63
- "^0.0.20",
63
+ "^0.0.25",
64
64
  "eslint":
65
65
  "^10.3.0",
66
66
  "globals":
@@ -80,7 +80,9 @@
80
80
  "base64-stream":
81
81
  "^1.0.0",
82
82
  "crash-js":
83
- "^0.1.127",
83
+ "^0.1.130",
84
+ "fs":
85
+ "npm:@themartiancompany/fs@^0.0.8",
84
86
  "tmcsplit":
85
87
  "^0.0.10",
86
88
  "yargs":
package/txt2bin CHANGED
@@ -122,6 +122,11 @@ const
122
122
  _encoding_tools =
123
123
  require(
124
124
  "./encoding-tools");
125
+ /* global
126
+ _input_texts_check */
127
+ const
128
+ _input_texts_check =
129
+ _encoding_tools._input_texts_check;
125
130
  /* global
126
131
  _txt2bin */
127
132
  const
@@ -180,13 +185,14 @@ function
180
185
  _line;
181
186
  const
182
187
  _text = [
183
- ` Call date: ${make_date}`,
188
+ ` Make date: ${make_date}`,
184
189
  ` Runtime environment: ${runtime_environment}`,
185
190
  ` Argument type: ${argument_type}`,
186
191
  ` Encoding format: ${encoding_format}`,
187
192
  ` Output file: ${output_file}`,
188
193
  ` Input text file(s): ${input_texts}`,
189
194
  ];
195
+ _msg_info("perche");
190
196
  for ( _line of _text ) {
191
197
  _msg_info(
192
198
  _line);
@@ -251,6 +257,8 @@ function
251
257
  argument_type =
252
258
  "file";
253
259
  }
260
+ _input_texts_check(
261
+ input_texts);
254
262
  }
255
263
 
256
264
  function
@@ -279,11 +287,13 @@ function
279
287
  "y";
280
288
  _help_display =
281
289
  false;
282
- if ( "h" in _argv ) {
290
+ if ( _argv[
291
+ "h"]) {
283
292
  _help_display =
284
293
  true;
285
294
  }
286
- if ( "help" in _argv ) {
295
+ if ( _argv[
296
+ "help"] ) {
287
297
  _help_display =
288
298
  true;
289
299
  }
@@ -343,11 +353,13 @@ function
343
353
  _argv[
344
354
  "encoding-format"];
345
355
  }
346
- if ( "v" in _argv ) {
356
+ if ( _argv[
357
+ "v"] ) {
347
358
  verbose =
348
359
  true;
349
360
  }
350
- if ( "verbose" in _argv ) {
361
+ if ( _argv[
362
+ "verbose"] ) {
351
363
  verbose =
352
364
  true;
353
365
  }
@@ -397,6 +409,7 @@ if ( _cmdline_check(
397
409
  else {
398
410
  _url_parse();
399
411
  }
412
+ _overrides_set();
400
413
  _config_show();
401
414
  app_opts = [
402
415
  output_file,