Common Node.js APIs

Cloud9 is build on top of Node.js on the server. We experienced the benefits of using the same language on the server and on the client. After learning from the 1st and 2nd version of Cloud9, we decided to make our plugins client side only. After we got really used to the asynchronous programming style that Node.js offers we decided to base our client side plugins fs, proc and net on the Node's apis.

Many of the Node.js modules could be very useful when writing Cloud9 plugins. As mentioned the Cloud9 plugins are client side only and so we did the extra work of making them available for you in the browser, to use in your plugins. One of these modules is the path module that allows you to easily manipulate paths. The next example shows how to use these modules in your plugin:

var join = require("path").join;
var basename = require("path").basename;

var filename = basename("/home/ubuntu/test.js");
var newPath = join("/var/lib", filename);

These are all the Node.js modules that we support and their use case.

assertThis module is used for writing unit tests for your applications.
pathThis module contains utilities for handling and transforming file paths
querystringThis module provides utilities for dealing with query strings.
streamA stream is an abstract interface implemented by various objects in Node.
urlThis module has utilities for URL resolution and parsing.
wsA simple interface for web socket usage