How to use the @capacitor/core.FilesystemDirectory.Documents 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 / filesystem / filesystem.ts View on Github external
async readdir() {
    try {
      let ret = await Plugins.Filesystem.readdir({
        path: 'secrets',
        directory: FilesystemDirectory.Documents
      });
      console.log('Read dir', ret);
    } catch(e) {
      console.error('Unable to read dir', e);
    }
  }
github ionic-team / capacitor / electron / src / electron / filesystem.ts View on Github external
constructor() {
    super({
      name: 'Filesystem',
      platforms: ['electron']
    });
    this.fileLocations = {DRIVE_ROOT: '', DOCUMENTS: ''};

    let path = require("path");
    let os = require("os");
    if(os.platform == "win32" ) {
      this.fileLocations["DRIVE_ROOT"] = process.cwd().split(path.sep)[0];
    } else {
      this.fileLocations["DRIVE_ROOT"] = '/';
    }
    this.fileLocations[FilesystemDirectory.Documents] = path.join(os.homedir(), `Documents`) + path.sep;

    this.NodeFS = require('fs');
    this.Path = path;
  }