-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile.js
40 lines (30 loc) · 1.16 KB
/
file.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const electron=require('electron');
const fs=require('fs');
const { getCreationTime } = require('process');
const { getDiffieHellman } = require('crypto');
const textract=require('textract');
const folder='./files/';
const ipc=electron.ipcRenderer;
const shell=electron.shell;
function getfile(file){
let html=`<tr><td>${file}</td></tr>`;
document.querySelector('table tbody').insertAdjacentHTML('afterbegin',html);
}
document.querySelectorAll('table tr').forEach( item=>{
item.addEventListener('click',(e)=>{
console.log(1);
});
});
document.querySelector('#button').addEventListener('click',()=>{
let key=document.getElementById('input').value;
console.log(key);
ipc.send('asynchronous-message',key);
ipc.on('asynchronous-reply',(event,args)=>{
console.log( document.querySelector('table tbody tr').innerHTML);
getfile(args);
//shell.openItem(`${folder}${args}`);
//shell.openPath(`C:\\ Users\\ Bhaskar Sengupta\\ Desktop\\ electron projects\\ files\\ ${args}`)
shell.openPath("C:\\Users\\Bhaskar Sengupta\\Desktop\\electron projects\\files\\"+args)
}
)
});