Skip to main content

Installation and Configuration

This section guides you through the process of installing and configuring OSI in your application.

Installation

1. Install OSI On-Premises Package

Install the OSI on-premises package using npm:

npm install osi.onpremises

2. Add TypeScript Configuration

Add the following to your tsconfig.json:

{
"compilerOptions": {
"types": ["osi.onpremises"]
}
}

Configuration

1. Basic Setup

In your main file (e.g., index.ts), import and initialize OSI:

import { fs, Process, EventWatcher, os, db } from 'osi.onpremises';

// The modules named with lowercase characters are automatically initialized as singletons, so no need to initialized. Others are not.

2. TypeScript Configuration

Ensure your tsconfig.json includes the necessary compiler options:

{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}

Security Considerations

  1. Main Process Usage (Electron Only)

    • OSI modules should only be used in the main process
    • Never expose OSI directly to the renderer process
  2. IPC Communication (Electron Only)

    • Use IPC (Inter-Process Communication) to communicate between renderer and main processes
    • Implement proper validation for all IPC messages
  3. Error Handling

    • Implement proper error handling for all OSI operations
    • Use try-catch blocks for async operations

Next Steps

Now that you have installed and configured OSI, proceed to the First Application section to learn how to use OSI in your project.