Electron Usage
Prerequisites
Before proceeding, ensure the following are installed and set up:
- Node.js: Install the latest LTS version from Node.js official site.
- Python: Required by
node-gyp
. Install Python 3.x. - Build Tools:
- Linux: Install
build-essential
(e.g.,sudo apt install build-essential
on Ubuntu).
- Linux: Install
- filerix: Ensure the
filerix
library and its development files are installed. If you builtfilerix
manually, ensure the.so
files are in your library path.
Building the Node.js Wrapper with node-gyp
Navigate to the
example/electron
directory:bashcd example/electron
Run the following command to configure and build the wrapper:
bashnode-gyp configure node-gyp build
After building, the compiled Node.js addon (
filerix.node
) will be available in thebuild/Release
directory.
Installation
Ensure you are in the
example/electron
directory:bashcd example/electron
Install the required dependencies:
bashnpm install
Running the Example
- The example is set up in
example/electron
.
- The
getDrives
function gets all available mountable/mounted drives and returns an object. - The
getDriveUsage
function fetches and logs the disk usage information for a given path.
- To run the example:bash
npm run dev
Common issues
- If you encounter issues with library loading (e.g.,
filerix.so
not found), ensure the library path is correctly set:bashexport LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH