How to execute node command when some event occur in electron js window

I am making a electron js application which have two buttons.
I have assigned click event listners on both of them.
What I want to do uppon someone click them is to increase or decrease brightness respectively.

I have build a function in node.js that does increase the brighthness if we run using sudo command.

Here is the function:

let fs = require("fs");

function inc() {
  var data = fs.readFileSync(
    "/sys/class/backlight/amdgpu_bl1/brightness",
    "utf-8"
  );

  var newData = parseInt(data) + 10;
  if (newData > 255) {
    newData = 255;
  } else if (newData < 0) {
    newData = 0;
  }
  newData = newData.toString();

  fs.writeFileSync(
    "/sys/class/backlight/amdgpu_bl1/brightness",
    newData,
    "utf-8"
  );
}

The index.html code is:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Clock App</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <button onclick="incBright()">+</button>
    <button onclick="decBright()">-</button>
    <script src="script.js"></script>
  </body>
</html>

I want to execute the inc() function when someone click on the’+’ button!
elctron js app window

Can someone tell me is that even possible to do that or not.

I am using linux

I don’t have any idea about this stuff