{"id":28003,"library":"occam-server","title":"occam-server","description":"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.","status":"active","version":"7.0.13","language":"javascript","source_language":"en","source_url":"https://github.com/djalbat/occam-server","tags":["javascript"],"install":[{"cmd":"npm install occam-server","lang":"bash","label":"npm"},{"cmd":"yarn add occam-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add occam-server","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM import available; package.json does not declare 'type': 'module', but bundlers may support.","symbol":"loadFiles","correct":"import { loadFiles } from 'occam-server'"},{"note":"Default export does not exist; use named import.","wrong":"import loadFile from 'occam-server'","symbol":"loadFile","correct":"const { loadFile } = require('occam-server')"},{"note":"CommonJS require is the documented pattern.","wrong":"import { saveFile } from 'occam-server'","symbol":"saveFile","correct":"const { saveFile } = require('occam-server')"}],"quickstart":{"code":"const server = require('occam-server');\nconst { loadFiles, saveFile } = server;\n\nconst projectsDirectoryPath = '/path/to/projects';\nconst filePaths = ['README.md', 'package.json'];\nconst json = { filePaths };\n\nloadFiles(projectsDirectoryPath, json, (result) => {\n  if (result !== null) {\n    console.log('Files loaded:', JSON.stringify(result, null, 2));\n  } else {\n    console.error('Failed to load files');\n  }\n});","lang":"javascript","description":"Demonstrates loading files from a project directory using occam-server's loadFiles function with callback."},"warnings":[{"fix":"Check for null and use Files.fromJSON(json) from occam-open-cli.","message":"loadFiles returns JSON, not a Files instance; you must instantiate Files.fromJSON yourself.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Monitor the repository for updates or consider alternative solutions.","message":"Some functions may be renamed or removed in future versions; not actively developed.","severity":"deprecated","affected_versions":">=7.0"},{"fix":"Review source code to confirm callback signature; use try/catch for synchronous parts.","message":"All callbacks receive a second 'error' argument? The docs show single argument but ensure error handling.","severity":"gotcha","affected_versions":">=7.0.13"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'npm install occam-server'","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'occam-server'"},{"fix":"Use const { loadFiles } = require('occam-server');","cause":"Incorrect import: trying to use default import instead of named import.","error":"Uncaught TypeError: loadFiles is not a function"},{"fix":"Check if result is null before calling Files.fromJSON(result).","cause":"Assuming loadFiles always returns a non-null JSON.","error":"TypeError: Cannot read properties of null (reading 'fromJSON')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}