Socket
Socket
Sign inDemoInstall

@cocalc/api-client

Package Overview
Dependencies
268
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @cocalc/api-client

CoCalc api client - use cocalc from nodejs


Version published
Maintainers
2
Created

Readme

Source

Here's an example of how to use this API to connect to a project and do some basic things. This communicates via HTTP via the nextjs api.

NOTE: This is very new and not used by anything yet.

Set some environment variables. You'll have to get the API_KEY from the settings of your project.

export PROJECT_ID=6640ddad-4bdd-4745-8e63-8db74686a20e
export API_KEY=sk-FcnRs3NxsTZROgbF000001
export API_SERVER=http://localhost:9001

The run code in node from the shell in the current directory:

> a = require('@cocalc/api-client')

> await a.project.exec({project_id:process.env.PROJECT_ID, command:'ls -a'})

> await a.project.jupyterExec({project_id:process.env.PROJECT_ID, kernel:'python3-ubuntu', input:"import os; print('hi'*100, os.getpid())"})

Keywords

FAQs

Last updated on 03 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc