@owservable/folders 1.7.5 → 1.7.6
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/lib/functions/add.files.from.folder.d.ts +1 -1
- package/lib/functions/add.files.from.folder.js +11 -28
- package/lib/functions/add.files.from.folder.js.map +1 -1
- package/lib/functions/list.subfolders.by.name.d.ts +1 -1
- package/lib/functions/list.subfolders.by.name.js +12 -31
- package/lib/functions/list.subfolders.by.name.js.map +1 -1
- package/lib/functions/list.subfolders.files.by.folder.name.d.ts +1 -1
- package/lib/functions/list.subfolders.files.by.folder.name.js +7 -18
- package/lib/functions/list.subfolders.files.by.folder.name.js.map +1 -1
- package/package.json +1 -1
- package/lib/types/item.stat.interface.d.ts +0 -5
- package/lib/types/item.stat.interface.js +0 -3
- package/lib/types/item.stat.interface.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const addFilesFromFolder:
|
|
1
|
+
declare const addFilesFromFolder: (files: string[], folder: string) => string[];
|
|
2
2
|
export default addFilesFromFolder;
|
|
@@ -1,36 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const fs = require("fs");
|
|
13
4
|
const path = require("path");
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})));
|
|
25
|
-
const subFiles = itemStats.filter((item) => !item.isDirectory);
|
|
26
|
-
const subFolders = itemStats.filter((item) => item.isDirectory);
|
|
27
|
-
subFiles.forEach((file) => {
|
|
28
|
-
files.push(file.fullPath);
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const addFilesFromFolder = (files, folder) => {
|
|
7
|
+
const subfolderNames = fs.readdirSync(folder);
|
|
8
|
+
const subFiles = (0, lodash_1.filter)(subfolderNames, (name) => !fs.lstatSync(path.join(folder, name)).isDirectory());
|
|
9
|
+
(0, lodash_1.each)(subFiles, (file) => {
|
|
10
|
+
files.push(path.join(folder, file));
|
|
11
|
+
});
|
|
12
|
+
const subFolders = (0, lodash_1.filter)(subfolderNames, (name) => fs.lstatSync(path.join(folder, name)).isDirectory());
|
|
13
|
+
(0, lodash_1.each)(subFolders, (subFolder) => {
|
|
14
|
+
files = addFilesFromFolder(files, path.join(folder, subFolder));
|
|
29
15
|
});
|
|
30
|
-
yield Promise.all(subFolders.map((subFolder) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
return yield addFilesFromFolder(files, subFolder.fullPath);
|
|
32
|
-
})));
|
|
33
16
|
return files;
|
|
34
|
-
}
|
|
17
|
+
};
|
|
35
18
|
exports.default = addFilesFromFolder;
|
|
36
19
|
//# sourceMappingURL=add.files.from.folder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.files.from.folder.js","sourceRoot":"","sources":["../../src/functions/add.files.from.folder.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"add.files.from.folder.js","sourceRoot":"","sources":["../../src/functions/add.files.from.folder.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;AAE7B,mCAAoC;AAEpC,MAAM,kBAAkB,GAAG,CAAC,KAAe,EAAE,MAAc,EAAY,EAAE;IACxE,MAAM,cAAc,GAAa,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAExD,MAAM,QAAQ,GAAa,IAAA,eAAM,EAAC,cAAc,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1H,IAAA,aAAI,EAAC,QAAQ,EAAE,CAAC,IAAY,EAAQ,EAAE;QACrC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAa,IAAA,eAAM,EAAC,cAAc,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3H,IAAA,aAAI,EAAC,UAAU,EAAE,CAAC,SAAiB,EAAQ,EAAE;QAC5C,KAAK,GAAG,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AACF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const listSubfoldersByName:
|
|
1
|
+
declare const listSubfoldersByName: (root: string, folderName: string) => string[];
|
|
2
2
|
export default listSubfoldersByName;
|
|
@@ -1,39 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const fs = require("fs");
|
|
13
4
|
const path = require("path");
|
|
14
|
-
const
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const listSubfoldersByName = (root, folderName) => {
|
|
15
7
|
let folders = [];
|
|
16
|
-
const subfolderNames =
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})));
|
|
26
|
-
const subfolders = itemStats.filter((item) => item.isDirectory);
|
|
27
|
-
const results = yield Promise.all(subfolders.map((subfolder) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
-
if (folderName === subfolder.name) {
|
|
29
|
-
return [subfolder.fullPath];
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return yield listSubfoldersByName(subfolder.fullPath, folderName);
|
|
33
|
-
}
|
|
34
|
-
})));
|
|
35
|
-
folders = results.flat();
|
|
8
|
+
const subfolderNames = fs.readdirSync(root);
|
|
9
|
+
const subfolders = (0, lodash_1.filter)(subfolderNames, (subfolderName) => fs.lstatSync(path.join(root, subfolderName)).isDirectory());
|
|
10
|
+
(0, lodash_1.each)(subfolders, (subfolder) => {
|
|
11
|
+
const fullPath = path.join(root, subfolder);
|
|
12
|
+
if (folderName === subfolder)
|
|
13
|
+
folders.push(fullPath);
|
|
14
|
+
else
|
|
15
|
+
folders = (0, lodash_1.concat)(folders, listSubfoldersByName(fullPath, folderName));
|
|
16
|
+
});
|
|
36
17
|
return folders;
|
|
37
|
-
}
|
|
18
|
+
};
|
|
38
19
|
exports.default = listSubfoldersByName;
|
|
39
20
|
//# sourceMappingURL=list.subfolders.by.name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.subfolders.by.name.js","sourceRoot":"","sources":["../../src/functions/list.subfolders.by.name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"list.subfolders.by.name.js","sourceRoot":"","sources":["../../src/functions/list.subfolders.by.name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;AAE7B,mCAA4C;AAE5C,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAY,EAAE;IAC3E,IAAI,OAAO,GAAa,EAAE,CAAC;IAE3B,MAAM,cAAc,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAA,eAAM,EAAC,cAAc,EAAE,CAAC,aAAqB,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAEjI,IAAA,aAAI,EAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC5C,IAAI,UAAU,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;;YAChD,OAAO,GAAG,IAAA,eAAM,EAAC,OAAO,EAAE,oBAAoB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AACF,kBAAe,oBAAoB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const listSubfoldersFilesByFolderName:
|
|
1
|
+
declare const listSubfoldersFilesByFolderName: (root: string, name: string) => string[];
|
|
2
2
|
export default listSubfoldersFilesByFolderName;
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
12
4
|
const add_files_from_folder_1 = require("./add.files.from.folder");
|
|
13
5
|
const list_subfolders_by_name_1 = require("./list.subfolders.by.name");
|
|
14
|
-
const listSubfoldersFilesByFolderName = (root, name) =>
|
|
6
|
+
const listSubfoldersFilesByFolderName = (root, name) => {
|
|
15
7
|
let files = [];
|
|
16
|
-
const folders =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return folderFiles;
|
|
21
|
-
})));
|
|
22
|
-
files = results.flat();
|
|
8
|
+
const folders = (0, list_subfolders_by_name_1.default)(root, name);
|
|
9
|
+
(0, lodash_1.each)(folders, (folder) => {
|
|
10
|
+
files = (0, add_files_from_folder_1.default)(files, folder);
|
|
11
|
+
});
|
|
23
12
|
return files;
|
|
24
|
-
}
|
|
13
|
+
};
|
|
25
14
|
exports.default = listSubfoldersFilesByFolderName;
|
|
26
15
|
//# sourceMappingURL=list.subfolders.files.by.folder.name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.subfolders.files.by.folder.name.js","sourceRoot":"","sources":["../../src/functions/list.subfolders.files.by.folder.name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"list.subfolders.files.by.folder.name.js","sourceRoot":"","sources":["../../src/functions/list.subfolders.files.by.folder.name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,mCAA4B;AAE5B,mEAAyD;AACzD,uEAA6D;AAE7D,MAAM,+BAA+B,GAAG,CAAC,IAAY,EAAE,IAAY,EAAY,EAAE;IAChF,IAAI,KAAK,GAAa,EAAE,CAAC;IACzB,MAAM,OAAO,GAAa,IAAA,iCAAoB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3D,IAAA,aAAI,EAAC,OAAO,EAAE,CAAC,MAAc,EAAE,EAAE;QAChC,KAAK,GAAG,IAAA,+BAAkB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AACF,kBAAe,+BAA+B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"item.stat.interface.js","sourceRoot":"","sources":["../../src/types/item.stat.interface.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC"}
|