P
P
partyzanx2020-06-17 22:35:35
Node.js
partyzanx, 2020-06-17 22:35:35

How to use paths in electron when you are packaging an application? Insert manually after unpacking?

The bottom line is, in index.html I write

<script>
        const fs = require('fs')
        let data = fs.readFileSync('data.txt')
        document.getElementById('data').innerHTML = data;
        require('./render.js')
    </script>


When I pack the application, the data.txt file is already in another location, in \resources\app\data.txt

How can I avoid manual drag and drop?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
partyzanx, 2020-06-18
@partyzanx

It was necessary to specify fs.readFileSync('./data.txt')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question