xshell 1.2.31 → 1.2.33
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/fflate.d.ts +2 -2
- package/fflate.js +12 -12
- package/file.d.ts +3 -2
- package/file.js +16 -1
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/path.d.ts +2 -2
package/fflate.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ export declare class Gzip {
|
|
|
139
139
|
@param opts The compression options
|
|
140
140
|
@returns The gzipped version of the data
|
|
141
141
|
*/
|
|
142
|
-
export declare function gzipSync(data: Uint8Array, opts?: GzipOptions):
|
|
142
|
+
export declare function gzipSync(data: Uint8Array, opts?: GzipOptions): Uint8Array<ArrayBuffer>;
|
|
143
143
|
/**
|
|
144
144
|
Expands GZIP data
|
|
145
145
|
@param data The data to decompress
|
|
@@ -179,7 +179,7 @@ export declare class Zlib {
|
|
|
179
179
|
@param opts The compression options
|
|
180
180
|
@returns The zlib-compressed version of the data
|
|
181
181
|
*/
|
|
182
|
-
export declare function zlibSync(data: Uint8Array, opts?: ZlibOptions):
|
|
182
|
+
export declare function zlibSync(data: Uint8Array, opts?: ZlibOptions): Uint8Array<ArrayBuffer>;
|
|
183
183
|
/**
|
|
184
184
|
Expands Zlib data
|
|
185
185
|
@param data The data to decompress
|
package/fflate.js
CHANGED
|
@@ -89,7 +89,7 @@ function hMap(cd, mb, r) {
|
|
|
89
89
|
return co;
|
|
90
90
|
}
|
|
91
91
|
// fixed length tree
|
|
92
|
-
const flt =
|
|
92
|
+
const flt = new Uint8Array(288);
|
|
93
93
|
for (let i = 0; i < 144; ++i)
|
|
94
94
|
flt[i] = 8;
|
|
95
95
|
for (let i = 144; i < 256; ++i)
|
|
@@ -99,7 +99,7 @@ for (let i = 256; i < 280; ++i)
|
|
|
99
99
|
for (let i = 280; i < 288; ++i)
|
|
100
100
|
flt[i] = 8;
|
|
101
101
|
// fixed distance tree
|
|
102
|
-
const fdt =
|
|
102
|
+
const fdt = new Uint8Array(32);
|
|
103
103
|
for (let i = 0; i < 32; ++i)
|
|
104
104
|
fdt[i] = 5;
|
|
105
105
|
// fixed length map
|
|
@@ -197,14 +197,14 @@ function inflt(dat, buf, st) {
|
|
|
197
197
|
st = {};
|
|
198
198
|
// Assumes roughly 33% compression ratio average
|
|
199
199
|
if (!buf)
|
|
200
|
-
buf =
|
|
200
|
+
buf = new Uint8Array(sl * 3);
|
|
201
201
|
// ensure buffer can fit at least l elements
|
|
202
202
|
function cbuf(l) {
|
|
203
203
|
let bl = buf.length;
|
|
204
204
|
// need to increase size to fit
|
|
205
205
|
if (l > bl) {
|
|
206
206
|
// Double or set to necessary, whichever is greater
|
|
207
|
-
const nbuf =
|
|
207
|
+
const nbuf = new Uint8Array(Math.max(bl * 2, l));
|
|
208
208
|
nbuf.set(buf);
|
|
209
209
|
buf = nbuf;
|
|
210
210
|
}
|
|
@@ -244,9 +244,9 @@ function inflt(dat, buf, st) {
|
|
|
244
244
|
const tl = hLit + bits(dat, pos + 5, 31) + 1;
|
|
245
245
|
pos += 14;
|
|
246
246
|
// length+distance tree
|
|
247
|
-
const ldt =
|
|
247
|
+
const ldt = new Uint8Array(tl);
|
|
248
248
|
// code length tree
|
|
249
|
-
const clt =
|
|
249
|
+
const clt = new Uint8Array(19);
|
|
250
250
|
for (let i = 0; i < hcLen; ++i)
|
|
251
251
|
// use index map to get real code
|
|
252
252
|
clt[clim[i]] = bits(dat, pos + i * 3, 7);
|
|
@@ -386,7 +386,7 @@ function hTree(d, mb) {
|
|
|
386
386
|
if (!s)
|
|
387
387
|
return [et, 0];
|
|
388
388
|
if (s == 1) {
|
|
389
|
-
const v =
|
|
389
|
+
const v = new Uint8Array(t[0].s + 1);
|
|
390
390
|
v[t[0].s] = 1;
|
|
391
391
|
return [v, 1];
|
|
392
392
|
}
|
|
@@ -583,7 +583,7 @@ const et = new Uint8Array(0);
|
|
|
583
583
|
// compresses data into a raw DEFLATE buffer
|
|
584
584
|
function dflt(dat, lvl, plvl, pre, post, lst) {
|
|
585
585
|
const s = dat.length;
|
|
586
|
-
const o =
|
|
586
|
+
const o = new Uint8Array(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);
|
|
587
587
|
// writing to this writes to the output buffer
|
|
588
588
|
const w = o.subarray(pre, o.length - post);
|
|
589
589
|
let pos = 0;
|
|
@@ -899,7 +899,7 @@ export function gzipSync(data, opts) {
|
|
|
899
899
|
@returns The decompressed version of the data
|
|
900
900
|
*/
|
|
901
901
|
export function gunzipSync(data, out) {
|
|
902
|
-
return inflt(data.subarray(gzs(data), -8), out ||
|
|
902
|
+
return inflt(data.subarray(gzs(data), -8), out || new Uint8Array(gzl(data)));
|
|
903
903
|
}
|
|
904
904
|
/** Streaming Zlib compression */
|
|
905
905
|
export class Zlib {
|
|
@@ -1041,7 +1041,7 @@ export class DecodeUTF8 {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
if (!this.p)
|
|
1043
1043
|
err(4);
|
|
1044
|
-
const dat =
|
|
1044
|
+
const dat = new Uint8Array(this.p.length + chunk.length);
|
|
1045
1045
|
dat.set(this.p);
|
|
1046
1046
|
dat.set(chunk, this.p.length);
|
|
1047
1047
|
const [ch, np] = dutf8(dat);
|
|
@@ -1091,7 +1091,7 @@ export class EncodeUTF8 {
|
|
|
1091
1091
|
*/
|
|
1092
1092
|
export function strToU8(str, latin1) {
|
|
1093
1093
|
if (latin1) {
|
|
1094
|
-
const ar =
|
|
1094
|
+
const ar = new Uint8Array(str.length);
|
|
1095
1095
|
for (let i = 0; i < str.length; ++i)
|
|
1096
1096
|
ar[i] = str.charCodeAt(i);
|
|
1097
1097
|
return ar;
|
|
@@ -1166,7 +1166,7 @@ export function unzipSync(data, opts) {
|
|
|
1166
1166
|
if (!c)
|
|
1167
1167
|
files[fn] = slc(data, b, b + sc);
|
|
1168
1168
|
else if (c == 8)
|
|
1169
|
-
files[fn] = inflateSync(data.subarray(b, b + sc),
|
|
1169
|
+
files[fn] = inflateSync(data.subarray(b, b + sc), new Uint8Array(su));
|
|
1170
1170
|
else
|
|
1171
1171
|
err(14, 'unknown compression type ' + c);
|
|
1172
1172
|
}
|
package/file.d.ts
CHANGED
|
@@ -120,9 +120,10 @@ export declare function fdelete(fp: string, { print }?: {
|
|
|
120
120
|
red?: boolean;
|
|
121
121
|
}): Promise<boolean>;
|
|
122
122
|
/** 清空文件夹中的内容,实际为删除该文件夹后新建 */
|
|
123
|
-
export declare function fdclear(fpd: string, { print }?: {
|
|
123
|
+
export declare function fdclear(fpd: string, { print, permission }?: {
|
|
124
124
|
print?: boolean;
|
|
125
|
-
|
|
125
|
+
permission?: boolean;
|
|
126
|
+
}): Promise<string>;
|
|
126
127
|
export interface FCopyOptions {
|
|
127
128
|
print?: boolean;
|
|
128
129
|
overwrite?: boolean;
|
package/file.js
CHANGED
|
@@ -288,11 +288,26 @@ export async function fdelete(fp, { print = true } = {}) {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
/** 清空文件夹中的内容,实际为删除该文件夹后新建 */
|
|
291
|
-
export async function fdclear(fpd, { print = true } = {}) {
|
|
291
|
+
export async function fdclear(fpd, { print = true, permission = false } = {}) {
|
|
292
|
+
let stat;
|
|
293
|
+
if (permission && process.platform !== 'win32')
|
|
294
|
+
stat = await fstat(fpd);
|
|
292
295
|
await fdelete(fpd, noprint);
|
|
293
296
|
await fmkdir(fpd, noprint);
|
|
297
|
+
if (stat) {
|
|
298
|
+
let handle;
|
|
299
|
+
try {
|
|
300
|
+
handle = await fopen(fpd, 'w');
|
|
301
|
+
await handle.chown(Number(stat.uid), Number(stat.gid));
|
|
302
|
+
await handle.chmod(Number(stat.mode));
|
|
303
|
+
}
|
|
304
|
+
finally {
|
|
305
|
+
handle?.close();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
294
308
|
if (print)
|
|
295
309
|
console.log(`清空了文件夹 ${fpd}`);
|
|
310
|
+
return fpd;
|
|
296
311
|
}
|
|
297
312
|
/** 复制文件或文件夹
|
|
298
313
|
会在因不存在父文件夹导致复制失败时,自动创建父文件夹,并再次尝试复制
|
package/net.d.ts
CHANGED
|
@@ -285,5 +285,5 @@ export declare class RemoteClient {
|
|
|
285
285
|
[inspect.custom](): {
|
|
286
286
|
remote: string;
|
|
287
287
|
websocket: string;
|
|
288
|
-
} & Omit<this, "websocket" | typeof import("util").inspect.custom | "
|
|
288
|
+
} & Omit<this, "call" | "websocket" | typeof import("util").inspect.custom | "remote" | "send">;
|
|
289
289
|
}
|
package/package.json
CHANGED
package/path.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare function extname(path: string): string;
|
|
|
54
54
|
/** `/` */
|
|
55
55
|
export declare const sep = "/";
|
|
56
56
|
/** The platform-specific file delimiter. ';' or ':'. */
|
|
57
|
-
export declare const delimiter: "
|
|
57
|
+
export declare const delimiter: ";" | ":";
|
|
58
58
|
/** Returns an object from a path string - the opposite of format().
|
|
59
59
|
@param path path to evaluate.
|
|
60
60
|
@throws {TypeError} if `path` is not a string. */
|
|
@@ -81,7 +81,7 @@ export declare let path: {
|
|
|
81
81
|
basename: typeof basename;
|
|
82
82
|
extname: typeof extname;
|
|
83
83
|
sep: string;
|
|
84
|
-
delimiter: "
|
|
84
|
+
delimiter: ";" | ":";
|
|
85
85
|
parse: typeof parse;
|
|
86
86
|
format: typeof format;
|
|
87
87
|
toNamespacedPath: typeof toNamespacedPath;
|