fix(plugins): Migrate filesystem usage to Node fs/fsPromises and upgrade smartfile to v13; add listFileTree helper and update tests

This commit is contained in:
2025-11-25 11:59:11 +00:00
parent 7ccd210c45
commit 634c204a00
13 changed files with 7423 additions and 248 deletions

View File

@@ -83,7 +83,7 @@ export class SmartArchive {
return urlStream;
}
if (this.sourceFilePath) {
const fileStream = plugins.smartfile.fs.toReadStream(this.sourceFilePath);
const fileStream = plugins.fs.createReadStream(this.sourceFilePath);
return fileStream;
}
}
@@ -116,14 +116,13 @@ export class SmartArchive {
);
const streamFile = streamFileArg;
const readStream = await streamFile.createReadStream();
await plugins.smartfile.fs.ensureDir(targetDir);
await plugins.fsPromises.mkdir(targetDir, { recursive: true });
const writePath = plugins.path.join(
targetDir,
streamFile.relativeFilePath || fileNameArg,
);
await plugins.smartfile.fs.ensureDir(plugins.path.dirname(writePath));
const writeStream =
plugins.smartfile.fsStream.createWriteStream(writePath);
await plugins.fsPromises.mkdir(plugins.path.dirname(writePath), { recursive: true });
const writeStream = plugins.fs.createWriteStream(writePath);
readStream.pipe(writeStream);
writeStream.on('finish', () => {
done.resolve();