xjs-common 8.4.0 → 8.4.1

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.
@@ -9,5 +9,6 @@ export declare namespace UFile {
9
9
  function read(p: MaybeArray<string>, encoding: BufferEncoding): string;
10
10
  function cp(from: MaybeArray<string>, to: MaybeArray<string>): void;
11
11
  function mv(from: MaybeArray<string>, to: MaybeArray<string>): void;
12
+ function ls(p: MaybeArray<string>): string[];
12
13
  function joinPath(...p: MaybeArray<string>[]): string;
13
14
  }
@@ -74,6 +74,13 @@ var UFile;
74
74
  fs.renameSync(f, t);
75
75
  }
76
76
  UFile.mv = mv;
77
+ function ls(p) {
78
+ const dir = joinPath(p);
79
+ if (!fs.statSync(dir).isDirectory())
80
+ throw new xjs_err_1.XjsErr(s_errCode, "Specified path for ls is not directory.");
81
+ return fs.readdirSync(dir);
82
+ }
83
+ UFile.ls = ls;
77
84
  function joinPath(...p) {
78
85
  return path.join(...p.flatMap(u_type_1.UType.takeAsArray));
79
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xjs-common",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
4
4
  "description": "library modules for nodejs + typescript that bundled general-purpose implementations.",
5
5
  "repository": {
6
6
  "type": "git",