Registry / http-networking / occam-server

occam-server

JSON →
library7.0.13jsnpmunverified

Server-side functionality for the Occam IDE, version 7.0.13. Provides file system operations such as loading and saving files, projects, and releases. Exports functions like loadFile, saveFile, loadFiles, loadProject, loadRelease, loadProjects, loadReleases, removeRelease, moveProjectEntries, removeProjectEntries, renameProjectEntries, createProjectEntries. Unlike typical REST APIs, it works over a JSON-based protocol (e.g., via occam-open-cli) and returns plain JSON rather than model instances. Release cadence is irregular; primarily maintained by djalbat. Depends on Node.js and is not browser-compatible.

npm install occam-server
INSTALL
IMPORT
SIG · OCCAM-SERVER
O
occam-server
http-networkingjavascriptv7.0.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

loadFiles
import { loadFiles } from 'occam-server'
ESM import available; package.json does not declare 'type': 'module', but bundlers may support.
loadFile
const { loadFile } = require('occam-server')
import loadFile from 'occam-server'
Default export does not exist; use named import.
saveFile
const { saveFile } = require('occam-server')
import { saveFile } from 'occam-server'
CommonJS require is the documented pattern.

Demonstrates loading files from a project directory using occam-server's loadFiles function with callback.

const server = require('occam-server'); const { loadFiles, saveFile } = server; const projectsDirectoryPath = '/path/to/projects'; const filePaths = ['README.md', 'package.json']; const json = { filePaths }; loadFiles(projectsDirectoryPath, json, (result) => { if (result !== null) { console.log('Files loaded:', JSON.stringify(result, null, 2)); } else { console.error('Failed to load files'); } });
Debug
Known issues
gotchaloadFiles returns JSON, not a Files instance; you must instantiate Files.fromJSON yourself.
fix
Check for null and use Files.fromJSON(json) from occam-open-cli.
affects: >=1.0
deprecatedSome functions may be renamed or removed in future versions; not actively developed.
fix
Monitor the repository for updates or consider alternative solutions.
affects: >=7.0
gotchaAll callbacks receive a second 'error' argument? The docs show single argument but ensure error handling.
fix
Review source code to confirm callback signature; use try/catch for synchronous parts.
affects: >=7.0.13
Errors
Common errors & fixes
Cannot find module 'occam-server'
Package not installed or not in node_modules.
fix
Run 'npm install occam-server'
Uncaught TypeError: loadFiles is not a function
Incorrect import: trying to use default import instead of named import.
fix
Use const { loadFiles } = require('occam-server');
TypeError: Cannot read properties of null (reading 'fromJSON')
Assuming loadFiles always returns a non-null JSON.
fix
Check if result is null before calling Files.fromJSON(result).
Upgrade
Version history
7.0.13latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
occam-server — npm install occam-server · libregistry