title: How can I convert a windows path to posix path using node path
body: <p>I'm developing on windows, but need to know how to convert a windows path (with backslashes <code>\</code>) into a POSIX path with forward slashes (<code>/</code>)?</p>
  
  <p>My goal is to convert <code>C:\repos\vue-t\tests\views\index\home.vue</code> to <code>C:/repos/vue-t/tests/views/index/home.vue</code></p>
  
  <p>so I can use it in an import on a file I'm writing to the disk</p>
  
  <pre><code>const appImport = `
  import Vue from "vue"
  import App from '${path}'
  
  function createApp (data) {
      const app = new Vue({
          data,
          render: h =&gt; h(App)
      })
      return app
  }`
  
  //this string is then written to the disk as a file
  </code></pre>
  
  <p>I'd prefer not to <code>.replace(/\\/g, '/')</code> the string, and would rather prefer to use a <code>require('path')</code> function.</p>