-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
54 lines (42 loc) · 1.13 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
Testing Area
*/
const fs = require('fs');
const path = require("path");
const {UAsset} = require("./reader");
//Get all files in directory
function getAllFiles(dirPath) {
let filesList = [];
const files = fs.readdirSync(dirPath);
for (const file of files) {
const filePath = path.join(dirPath, file);
const stat = fs.statSync(filePath);
if (stat.isFile()) {
filesList.push(filePath);
} else if (stat.isDirectory()) {
// Recursively get files from subdirectories
filesList = filesList.concat(getAllFiles(filePath));
}
}
return filesList;
}
async function RunTest()
{
const Files = getAllFiles("testfiles");
for (const fi in Files)
{
const File = Files[fi];
console.log("------------------------- Probing #: " + File);
const Asset = new UAsset(File);
await Asset.load();
if(Asset.getUnrealVersion() !== null)
{
console.log(Asset.toJSON());
}
else
{
console.error("File: " + File + " is not an UAsset!" );
}
}
}
RunTest();