How to use the @capacitor/core.Plugins.Filesystem function in @capacitor/core

To help you get started, we’ve selected a few @capacitor/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionic-team / capacitor / example / src / pages / camera / camera.ts View on Github external
resultType: CameraResultType.Uri
    })
    console.log('Got image back', image.path, image.webPath, image.format, image.exif);


    const imageData = await Filesystem.readFile({
      path: image.path
    });

    await Filesystem.writeFile({
      path: 'cool-photo.jpg',
      directory: FilesystemDirectory.Data,
      data: imageData.data
    });

    let stat = await Plugins.Filesystem.stat({
      path: 'cool-photo.jpg',
      directory: FilesystemDirectory.Data
    });

    console.log(stat);

    //this.image = this.sanitizer.bypassSecurityTrustResourceUrl("data:image/jpeg;base64," + imageData.data);
    const imageUrl = image.webPath;
    this.image = this.sanitizer.bypassSecurityTrustResourceUrl(imageUrl);
  }
github ionic-team / capacitor / example / src / pages / filesystem / filesystem.ts View on Github external
    return this.doAll(paths, path => Plugins.Filesystem.rmdir({path}));
  }