Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/capacitor-plugin/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
// Type definitions for the Capacitor Filesystem API
interface FilesystemPlugin {
readFile(options: { path: string }): Promise<{ data: string }>;
stat(options: { path: string }): Promise<{ data: string }>;
writeFile(options: {
path: string;
data: string;
Expand Down Expand Up @@ -469,9 +470,11 @@ export class FileTransferWeb extends WebPlugin implements FileTransferPlugin {
const pathParts = path.split("/");
if (pathParts.length > 1) {
const directory = pathParts.slice(0, -1).join("/");
await filesystem.mkdir({
path: directory,
recursive: true,
await filesystem.stat({path: directory}).catch(async ()=>{
await filesystem.mkdir({
path: directory,
recursive: true,
});
});
}

Expand Down