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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user