xshell 1.2.71 → 1.2.72

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/file.d.ts CHANGED
@@ -78,6 +78,7 @@ export declare function fequals(fp_left: string, fp_right: string, { print }?: {
78
78
  export interface FWriteOptions {
79
79
  print?: boolean;
80
80
  mtime?: number;
81
+ flush?: boolean;
81
82
  }
82
83
  /** 写入 data 到 fp 路径或句柄所指的文件
83
84
  会在因不存在父文件夹导致写入失败时,自动创建父文件夹,并再次尝试写入
@@ -90,7 +91,8 @@ export interface FWriteOptions {
90
91
  - any: 通过 JSON.stringify 转为文本后写入文件
91
92
  - options?:
92
93
  - print?: `true`
93
- - mtime?: 在写入后设置修改时间 (utc 毫秒数) */
94
+ - mtime?: 在写入后设置修改时间 (utc 毫秒数)
95
+ - flush?: 用 filehandle.sync() 刷到硬盘,确保已写入 */
94
96
  export declare function fwrite(fp: string, data: string | Uint8Array | any, options?: FWriteOptions): Promise<string>;
95
97
  export declare function fwrite(fp: FileHandle, data: string | Uint8Array | any, options?: FWriteOptions): Promise<FileHandle>;
96
98
  export declare function fwrite(fp: string | FileHandle, data: string | Uint8Array | any, options?: FWriteOptions): Promise<string | FileHandle>;
package/file.js CHANGED
@@ -87,7 +87,7 @@ export async function fequals(fp_left, fp_right, { print = true } = {}) {
87
87
  return false;
88
88
  }
89
89
  }
90
- export async function fwrite(fp, data, { print = true, mtime } = {}) {
90
+ export async function fwrite(fp, data, { print = true, mtime, flush } = {}) {
91
91
  const is_handle = typeof fp === 'object' && fp && 'fd' in fp;
92
92
  if (is_handle) {
93
93
  if (print)
@@ -113,13 +113,14 @@ export async function fwrite(fp, data, { print = true, mtime } = {}) {
113
113
  }
114
114
  return fp;
115
115
  }
116
+ const write_options = { flush };
116
117
  try {
117
- await fsp.writeFile(fp, data);
118
+ await fsp.writeFile(fp, data, write_options);
118
119
  }
119
120
  catch (error) {
120
121
  if (error.code === 'ENOENT' && !is_handle) {
121
122
  await fmkdir(fp.fdir, noprint);
122
- await fsp.writeFile(fp, data);
123
+ await fsp.writeFile(fp, data, write_options);
123
124
  }
124
125
  else
125
126
  throw error;
package/net.d.ts CHANGED
@@ -278,5 +278,5 @@ export declare class RemoteClient {
278
278
  [inspect.custom](): {
279
279
  remote: string;
280
280
  websocket: string;
281
- } & Omit<this, typeof import("util").inspect.custom | "call" | "websocket" | "remote" | "send">;
281
+ } & Omit<this, "call" | typeof import("util").inspect.custom | "websocket" | "remote" | "send">;
282
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.71",
3
+ "version": "1.2.72",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
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;