decord/source/utils/FileManagerUtils.android.tsx

203 lines
6.1 KiB
TypeScript
Raw Normal View History

// Module ID: 8136
// Function ID: 8137
2026-07-20 16:05:17 +00:00
// Name: _readFile
2026-09-02 09:53:35 +00:00
// Dependencies: [5, 3, 1270, 2]
2026-07-20 16:05:17 +00:00
// Exports: clearFolder, moveFile, readFile, removeFile, writeFile
// Module 8136 (_readFile)
2026-08-24 06:08:38 +00:00
import timestampDefault from "timestamp" /* 3 */;
2026-09-02 09:53:35 +00:00
import enforcingDefault from "enforcing" /* 1270 */;
2026-08-24 06:08:38 +00:00
import closure_2 from "asyncGeneratorStep" /* 5 */;
2026-07-22 07:54:56 +00:00
2026-07-29 08:29:29 +00:00
function _readFile() {
const self = this;
const tmp = callback((arg0, arg1, arg2) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
closure_2 = arg2;
c7 = 0;
c8 = 0;
c6 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0, arg1, arg2) {
if (c8 === 2) {
c8 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp7 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
try {
c8 = 2;
if (0 === c7) {
if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c8 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_4 = tmp3;
2026-07-29 08:29:29 +00:00
let logger = tmp5;
const callback = dependencyMap;
2026-08-24 06:08:38 +00:00
dependencyMap = closure_2;
closure_2 = undefined;
2026-07-29 08:29:29 +00:00
const tmp37 = (function getBaseDirectory(closure_0) {
if (null == callback(table[2])) {
return null;
} else {
if ("cache" === closure_0) {
let tmpResult = tmp(tmp2[2]);
let DocumentsDirPath = tmpResult.getConstants().CacheDirPath;
} else {
tmpResult = tmp(tmp2[2]);
DocumentsDirPath = tmpResult.getConstants().DocumentsDirPath;
}
return DocumentsDirPath;
}
})(callback);
2026-08-24 06:08:38 +00:00
closure_2 = tmp37;
2026-07-29 08:29:29 +00:00
if (null == tmp37) {
c8 = 3;
return { value: null, done: true };
} else {
c7 = 1;
c8 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
2026-09-02 09:53:35 +00:00
obj1[0] = callback(1270).fileExists(tmp37 + "/" + tmp35);
2026-07-29 08:29:29 +00:00
return obj1;
}
tmp35 = dependencyMap;
}
} else if (1 === tmp8) {
if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c8 = 3;
let obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else if (arg1) {
2026-08-24 06:08:38 +00:00
c6 = 1;
2026-09-02 09:53:35 +00:00
obj2 = callback(1270);
2026-07-29 08:29:29 +00:00
c7 = 3;
c8 = 1;
const obj3 = { value: null, done: false };
2026-08-24 06:08:38 +00:00
obj3[0] = obj2.readFile(closure_2 + "/" + callback, dependencyMap);
2026-07-29 08:29:29 +00:00
return obj3;
} else {
c8 = 3;
return { value: null, done: true };
}
} else if (2 === tmp8) {
c6 = 0;
logger = closure_5;
logger.error("Failed to read file from disk", logger);
c8 = 3;
return { value: null, done: true };
} else if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 0;
c8 = 3;
const obj4 = { value: null, done: true };
obj4[0] = arg1;
return obj4;
} else {
c6 = 0;
c8 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
}
} catch (tmp25) {
closure_5 = tmp25;
if (tmp4 === c6) {
c8 = tmp2;
throw tmp25;
} else {
c7 = tmp;
}
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
})();
});
2026-08-24 06:08:38 +00:00
closure_4 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
applyArgumentsResult = apply(self, arguments);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
let closure_3 = new timestampDefault("FileManagerUtils");
const tmp2 = new timestampDefault("FileManagerUtils");
const result = require("set").fileFinishedImporting("utils/FileManagerUtils.android.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const writeFile = function writeFile(cache, c5, c6, utf8) {
2026-08-24 06:08:38 +00:00
const obj = enforcingDefault;
2026-07-20 16:05:17 +00:00
let nextPromise;
2026-07-29 08:29:29 +00:00
if (obj != null) {
nextPromise = obj.writeFile(cache, c5, c6, utf8).then((arg0) => "file:" + arg0);
const writeFileResult = obj.writeFile(cache, c5, c6, utf8);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (nextPromise == null) {
2026-07-20 16:05:17 +00:00
nextPromise = Promise.reject("RTNFileManager doesn't exist?");
}
return nextPromise;
};
2026-07-29 08:29:29 +00:00
export const moveFile = function moveFile(closure_0, closure_02, closure_1) {
2026-08-24 06:08:38 +00:00
const obj = enforcingDefault;
2026-07-20 16:05:17 +00:00
let moveFileResult;
2026-07-29 08:29:29 +00:00
if (obj != null) {
moveFileResult = obj.moveFile(closure_0, closure_02, closure_1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (moveFileResult == null) {
2026-07-20 16:05:17 +00:00
moveFileResult = Promise.reject(false);
}
return moveFileResult;
};
2026-07-29 08:29:29 +00:00
export const removeFile = function removeFile(cache, closure_1) {
2026-08-24 06:08:38 +00:00
const obj = enforcingDefault;
2026-07-20 16:05:17 +00:00
let removeFileResult;
2026-07-29 08:29:29 +00:00
if (obj != null) {
removeFileResult = obj.removeFile(cache, closure_1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (removeFileResult == null) {
2026-07-20 16:05:17 +00:00
removeFileResult = Promise.reject(false);
}
return removeFileResult;
};
2026-08-24 06:08:38 +00:00
export const clearFolder = function clearFolder(cache, closure_1_5) {
const obj = enforcingDefault;
2026-07-20 16:05:17 +00:00
let clearFolderResult;
2026-07-29 08:29:29 +00:00
if (obj != null) {
2026-08-24 06:08:38 +00:00
clearFolderResult = obj.clearFolder(cache, closure_1_5);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (clearFolderResult == null) {
2026-07-20 16:05:17 +00:00
clearFolderResult = Promise.reject(false);
}
return clearFolderResult;
};
2026-07-29 08:29:29 +00:00
export const readFile = function readFile(documents, closure_1, utf8) {
const self = this;
const apply = _readFile.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};