|
@@ -1,6 +1,6 @@
|
|
|
import fs, { readFileSync } from 'fs';
|
|
import fs, { readFileSync } from 'fs';
|
|
|
import path from 'path';
|
|
import path from 'path';
|
|
|
-import { pipeline } from 'stream';
|
|
|
|
|
|
|
+import { pipeline } from 'stream/promises';
|
|
|
|
|
|
|
|
import { GrowiPluginType } from '@growi/core';
|
|
import { GrowiPluginType } from '@growi/core';
|
|
|
import type { GrowiThemeMetadata, ViteManifest } from '@growi/core';
|
|
import type { GrowiThemeMetadata, ViteManifest } from '@growi/core';
|
|
@@ -9,7 +9,6 @@ import { importPackageJson, validateGrowiDirective } from '@growi/pluginkit/dist
|
|
|
// eslint-disable-next-line no-restricted-imports
|
|
// eslint-disable-next-line no-restricted-imports
|
|
|
import axios from 'axios';
|
|
import axios from 'axios';
|
|
|
import type mongoose from 'mongoose';
|
|
import type mongoose from 'mongoose';
|
|
|
-import streamToPromise from 'stream-to-promise';
|
|
|
|
|
import unzipStream from 'unzip-stream';
|
|
import unzipStream from 'unzip-stream';
|
|
|
|
|
|
|
|
import loggerFactory from '~/utils/logger';
|
|
import loggerFactory from '~/utils/logger';
|
|
@@ -211,9 +210,7 @@ export class GrowiPluginService implements IGrowiPluginService {
|
|
|
private async unzip(zipFilePath: fs.PathLike, destPath: fs.PathLike): Promise<void> {
|
|
private async unzip(zipFilePath: fs.PathLike, destPath: fs.PathLike): Promise<void> {
|
|
|
try {
|
|
try {
|
|
|
const readZipStream = fs.createReadStream(zipFilePath);
|
|
const readZipStream = fs.createReadStream(zipFilePath);
|
|
|
- const unzipFileStream = pipeline(readZipStream, unzipStream.Extract({ path: destPath.toString() }));
|
|
|
|
|
-
|
|
|
|
|
- await streamToPromise(unzipFileStream);
|
|
|
|
|
|
|
+ await pipeline(readZipStream, unzipStream.Extract({ path: destPath.toString() }));
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
logger.error(err);
|