This commit is contained in:
Fredrik Burmester
2024-09-27 17:35:51 +02:00
parent 41d209f3b7
commit a46737442d
4 changed files with 63 additions and 30 deletions

View File

@@ -70,28 +70,28 @@ const downloads: React.FC = () => {
if (info.exists) {
if (info.isDirectory) {
// List items in the directory
const subItems = await FileSystem.readDirectoryAsync(fullPath);
if (subItems.length === 0) {
console.log(`Directory ${item} is empty.`);
} else {
console.log(`Items in ${item}:`, subItems);
// If item ends in m3u8, print the content of the file
const m3u8Files = subItems.filter((subItem) =>
subItem.endsWith(".m3u8")
);
if (m3u8Files.length === 0) {
console.log(`No .m3u8 files found in ${item}.`);
} else {
for (let subItem of m3u8Files) {
console.log(
`Content of ${subItem}:`,
await FileSystem.readAsStringAsync(
`${fullPath}/${subItem}`
)
);
}
}
}
// const subItems = await FileSystem.readDirectoryAsync(fullPath);
// if (subItems.length === 0) {
// console.log(`Directory ${item} is empty.`);
// } else {
// console.log(`Items in ${item}:`, subItems);
// // If item ends in m3u8, print the content of the file
// const m3u8Files = subItems.filter((subItem) =>
// subItem.endsWith(".m3u8")
// );
// if (m3u8Files.length === 0) {
// console.log(`No .m3u8 files found in ${item}.`);
// } else {
// for (let subItem of m3u8Files) {
// console.log(
// `Content of ${subItem}:`,
// await FileSystem.readAsStringAsync(
// `${fullPath}/${subItem}`
// )
// );
// }
// }
// }
} else {
console.log(`${item} is a file`);
}