New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

occjs-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

occjs-wrapper

The purpose of this library is to provide a wrapper around the OCCJS library that helps with handling method overloads.

latest
Source
npmnpm
Version
2.0.0-beta.b5ff984-21
Version published
Maintainers
1
Created
Source

OCCJS-Wrapper (Opencascade.js Wrapper)

The purpose of this library is to provide a wrapper around the OCCJS library that helps with handling method overloads.

So instead of writing this:

const point1 = new oc.gp_Pnt_3(0, 0, 0);
const point2 = new oc.gp_Pnt_2(new oc.gp_XYZ_1(0, 0, 0));

You can write this:

const point1 = new oc.gp_Pnt(0, 0, 0);
const point2 = new oc.gp_Pnt(new oc.gp_XYZ(0, 0, 0));

The library will automatically resolve the correct overload based on the parameter types you pass. When using with Typescript you get the overloads signatures information in the IDE.

Currently the library does not handle null parameters, so if any of the parameters is null, it will not be able to resolve the correct overload. This will be fixed in the future.

Please note I tested this only on a project I work on and it is working fine. I'll keep fixing bugs as I encounter them.

Installation

npm install occjs-wrapper

Usage

Browser (single-threaded)

import initOpenCascade from 'occjs-wrapper';

const oc = await initOpenCascade();

Browser (multi-threaded)

Requires SharedArrayBuffer, which needs COOP/COEP headers on your server.

import initOpenCascade from 'occjs-wrapper/multi-threaded';

const oc = await initOpenCascade();

Node.js (single-threaded)

import initOpenCascade from 'occjs-wrapper/node';

const oc = await initOpenCascade();

Node.js (multi-threaded)

import initOpenCascade from 'occjs-wrapper/node/multi-threaded';

const oc = await initOpenCascade();

Importing types

import initOpenCascade from 'occjs-wrapper';
import { gp_Pnt } from 'occjs-wrapper';

It would be cool to make this part of the original library, but it'll require some time and effort to integrate it which currently I do not have. If anyone is interested in contributing to the original library, please feel free to do so.

FAQs

Package last updated on 04 Apr 2026

Related posts