title: How to use electron's app.getPath() to store data?
body: <p>I want to store images on the users computer, so I figure it should be stored in users data folder, as described <a href="https://github.com/electron/electron/blob/master/docs/api/app.md#appgetpathname" rel="noreferrer">here</a>.</p>
  
  <blockquote>
    <p><strong><code>app.getPath(name)</code></strong></p>
    
    <p><code>name</code>. Returns String - A path to a special directory or file associated with name. On failure an Error is thrown. You can request the following paths by the name:</p>
    
    <ul>
    <li><code>home</code> User's home directory</li>
    <li><p><code>appData</code> Per-user application data directory, which by default points to:</p>
    
    <p>%APPDATA% on Windows
    $XDG_CONFIG_HOME or ~/.config on Linux
    ~/Library/Application Support on macOS</p></li>
    <li><p><code>userData</code> The directory for storing your app's configuration files, which by default it is the appData directory appended with your app's name.</p></li>
    <li>...</li>
    </ul>
  </blockquote>
  
  <p>This is what I think you're supposed to do:</p>
  
  <pre><code>const app = require('electron');
  alert(app.getPath('userData'));
  </code></pre>
  
  <p>But I get "getPath is not a function". I am not sure where to put it. It does not work from my html file or the renderer file, and I'm not sure how to use it from the main file because that's not linked to the web page.</p>