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-essentialon Ubuntu).
- Linux: Install
- filerix: Ensure the
filerixlibrary and its development files are installed. If you builtfilerixmanually, ensure the.sofiles are in your library path.
Building the Node.js Wrapper with node-gyp
Navigate to the
example/electrondirectory:bashcd example/electronRun the following command to configure and build the wrapper:
bashnode-gyp configure node-gyp buildAfter building, the compiled Node.js addon (
filerix.node) will be available in thebuild/Releasedirectory.
Installation
Ensure you are in the
example/electrondirectory:bashcd example/electronInstall the required dependencies:
bashnpm install
Running the Example
- The example is set up in
example/electron.
- The
getDrivesfunction gets all available mountable/mounted drives and returns an object. - The
getDriveUsagefunction 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.sonot found), ensure the library path is correctly set:bashexport LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
