Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/playground/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ export const RecommendedPHPVersion = '8.0';
/**
* Unzip a zip file inside Playground.
*/
const tmpPath = '/tmp/file.zip';
export const unzipFile = async (
php: UniversalPHP,
zipPath: string | File,
extractToPath: string
) => {
if (zipPath instanceof File) {
const zipFile = zipPath;
zipPath = '/tmp/file.zip';
zipPath = tmpPath;
await php.writeFile(
zipPath,
new Uint8Array(await zipFile.arrayBuffer())
Expand All @@ -41,8 +42,8 @@ export const unzipFile = async (
php,
`unzip(${js.zipPath}, ${js.extractToPath});`
);
if (php.fileExists(zipPath)) {
await php.unlink(zipPath);
if (php.fileExists(tmpPath)) {
await php.unlink(tmpPath);
}
};

Expand Down