vue electron read file
import fs from 'fs'
import readline from 'readline'
import iconv from 'iconv-lite'
ipcMain.on('readfile', async (event, arg) => {
await readLines()
event.sender.send('readfile-reply', 'complete')
})
function readLines() {
return new Promise((resolve, reject) => {
stream = fs.createReadStream(filePath).pipe(iconv.decodeStream('shift-jis'))
let reader = readline.createInterface(stream, {})
reader
.on('line', line => {
insertLine(line)
})
.on('close', () => {
resolve() // "Resolve" in the close event.
})
.on('error', function(err) {
reject(err)
})
})
}
Also in JavaScript:
- array.flat
- .classList
- how to check if all inputs are not empty with javascript
- how to comment out code in react js
- javascript object entries
- concat js mdn
- javascript is object
- nuxt looks for npm_modules on express
- javascript version of sleep
- boble sorting javascript
- jquery example sheetjs
- call apply bind
- jquery number format thousand k
- dotenv not loading process.env in node
- js crpyto generate safe token
- react native clear cach
- node js class
- _.get alternative
- javascript load image programmatically
- jquery ajax CORS
- jsx input change
- jquery add class to body
- localstorage javascript
- ladder physics javascript