tmcsplit 0.0.5 → 0.0.9
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/libtmcsplit +69 -2
- package/package.json +6 -6
- package/tmcsplit.js +1 -1
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.
|
|
5
|
+
"0.0.9",
|
|
6
6
|
"description":
|
|
7
7
|
"Basic Javascript implementation of GNU Split.",
|
|
8
8
|
"funding": {
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"crash-js":
|
|
76
|
-
"^0.1.
|
|
76
|
+
"^0.1.81",
|
|
77
77
|
"split-file":
|
|
78
|
-
"npm:@themartiancompany/split-file@2.3.
|
|
78
|
+
"npm:@themartiancompany/split-file@2.3.15"
|
|
79
79
|
},
|
|
80
80
|
"type":
|
|
81
81
|
"commonjs",
|
|
@@ -92,11 +92,11 @@
|
|
|
92
92
|
"build-bin":
|
|
93
93
|
"npx webpack --mode 'production' --config 'webpack.config.cjs' --stats-error-details",
|
|
94
94
|
"build":
|
|
95
|
-
"npm run
|
|
95
|
+
"npm run build-fs-worker && npm run build-lib && npm run build-bin",
|
|
96
96
|
"lint":
|
|
97
97
|
"npx eslint .",
|
|
98
|
-
"publish-
|
|
99
|
-
"npm run build && npm publish --access public",
|
|
98
|
+
"publish-npm":
|
|
99
|
+
"npm lint && npm run build && npm publish --access public",
|
|
100
100
|
"start":
|
|
101
101
|
"npx safely-serve --help # index.html --port 3000 --https --no-cache",
|
|
102
102
|
"test":
|