tmcsplit 0.0.7 → 0.0.10

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/README.md CHANGED
@@ -22,6 +22,10 @@
22
22
 
23
23
  # The Martian Company's Split (`tmcsplit`)
24
24
 
25
+ [![NPM version](
26
+ https://img.shields.io/npm/last-update/tmcsplit)](
27
+ https://npmjs.org/package/tmcsplit)
28
+
25
29
  Javascript GNU Split rewrite.
26
30
 
27
31
  Splittable with number of parts or maximum bytes per part.
package/fs-worker.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e={816(e,o,n){function t(){let e;return"undefined"==typeof window&&void 0!==n.g&&n.g.global===n.g&&"function"!=typeof n||(e=function(){let e;try{e=n(816)}catch(e){console.log(e);const o="Error importing the '@themartiancompany/opfs' module as 'opfs'. If you got this error while bundling a webpack for a project depending on this module double check its 'webpack.config.js' file or whether the 'opfs' module is listed in developer dependencies and install them.I'm sorry for this inconvenience but Node packagement system does not currently distinguish 'development' from 'build' dependencies.";throw console.error(o),e}return e}()),e}const r=t();e.exports=r,e.exports.getModule=function(e){let o;if(""==_module_name||"undefined"==typeof _module_name)o=t();else if("opfs"==_module_name)o=n(816);else{if("fs"!=_module_name){const e="Unknown file system module "+`'${_module_name}'.`.const;throw _error={msg:e},console.error(e),_error}o=n(816)}return o}},314(e,o,n){const t=n(816);_sync_agent=t.startSyncAgent,e.exports={_sync_agent},_sync_agent()}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(314)})();
1
+ (()=>{var e={816(e,o,n){function t(){let e;return"undefined"==typeof window&&void 0!==n.g&&n.g.global===n.g&&"function"!=typeof n||(e=function(){let e;try{e=n(816)}catch(e){console.log(e);const o="Error importing the '@themartiancompany/opfs' module as 'opfs'. If you got this error while bundling a webpack for a project depending on this module double check its 'webpack.config.js' file or whether the 'opfs' module is listed in developer dependencies and install them.I'm sorry for this inconvenience but Node packagement system does not currently distinguish 'development' from 'build' dependencies.";throw console.error(o),e}return e}()),e}const r=t();e.exports=r,e.exports.getModule=function(e){let o;if(""==_module_name||"undefined"==typeof _module_name)o=t();else if("opfs"==_module_name)o=_opfs_module_auto_detect();else{if("fs"!=_module_name){const e="Unknown file system module "+`'${_module_name}'.`.const;throw _error={msg:e},console.error(e),_error}o=n(816)}return o}},314(e,o,n){const t=n(816);_sync_agent=t.startSyncAgent,e.exports={_sync_agent},_sync_agent()}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(314)})();
package/libtmcsplit CHANGED
@@ -46,12 +46,73 @@ const
46
46
  _libcrash =
47
47
  require(
48
48
  'crash-js');
49
+ const
50
+ _basename =
51
+ _libcrash._basename;
52
+ const
53
+ _dirname =
54
+ _libcrash._dirname;
55
+ const
56
+ _ls =
57
+ _libcrash._ls;
49
58
  const
50
59
  _msg_info =
51
60
  _libcrash._msg_info;
52
61
  const
53
62
  _msg_error =
54
63
  _libcrash._msg_error;
64
+ const
65
+ _mv =
66
+ _libcrash._mv;
67
+
68
+ async function
69
+ _output_files_get(
70
+ _input_file,
71
+ _output_prefix) {
72
+ let
73
+ _file,
74
+ _mv_args,
75
+ _output_file,
76
+ _output_files,
77
+ _part_no;
78
+ _output_files =
79
+ [];
80
+ const
81
+ _file_name =
82
+ _basename(
83
+ _input_file);
84
+ const
85
+ _pattern =
86
+ `${_file_name}.sf-part`
87
+ const
88
+ _dir =
89
+ _dirname(
90
+ _input_file);
91
+ const
92
+ _dir_content =
93
+ _ls(
94
+ _dir);
95
+ for ( _file of _dir_content ) {
96
+ if ( _file.startsWith(
97
+ _pattern)) {
98
+ _part_no =
99
+ _file.replace(
100
+ _pattern,
101
+ "");
102
+ _output_file =
103
+ `${_output_prefix}${_part_no}`;
104
+ _mv_args = [
105
+ `${_input_file}.sf-part${_part_no}`,
106
+ _output_file
107
+ ];
108
+ _mv(
109
+ _mv_args);
110
+ _output_files.push(
111
+ _output_file);
112
+ }
113
+ }
114
+ return _output_files;
115
+ }
55
116
 
56
117
  async function
57
118
  _split(
@@ -60,7 +121,8 @@ async function
60
121
  _chunks_amount,
61
122
  _size_max) {
62
123
  let
63
- _msg;
124
+ _msg,
125
+ _output_files;
64
126
  const
65
127
  _chunks_amount_not_number =
66
128
  typeof(
@@ -82,7 +144,7 @@ async function
82
144
  Number(
83
145
  _size_max);
84
146
  if ( _chunks_amount > 0 ) {
85
- _split_file(
147
+ await _split_file(
86
148
  _input_file,
87
149
  _chunks_amount);
88
150
  }
@@ -91,6 +153,11 @@ async function
91
153
  _input_file,
92
154
  _size_max);
93
155
  }
156
+ _output_files =
157
+ _output_files_get(
158
+ _input_file,
159
+ _output_prefix);
160
+ return _output_files;
94
161
  }
95
162
 
96
163
  module.exports = {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name":
3
3
  "tmcsplit",
4
4
  "version":
5
- "0.0.7",
5
+ "0.0.10",
6
6
  "description":
7
7
  "Basic Javascript implementation of GNU Split.",
8
8
  "funding": {
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "crash-js-webpack":
60
- "^0.0.3",
60
+ "^0.0.11",
61
61
  "eslint":
62
62
  "^10.0.3",
63
63
  "globals":
@@ -73,9 +73,9 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "crash-js":
76
- "^0.1.76",
76
+ "^0.1.115",
77
77
  "split-file":
78
- "npm:@themartiancompany/split-file@2.3.14"
78
+ "npm:@themartiancompany/split-file@2.3.15"
79
79
  },
80
80
  "type":
81
81
  "commonjs",