sandbox/sandbox.js
function(url, done) {
  var receive = function(res) {
    if (res.statusCode != 200) {
      var msg = 'Failed to load ' + url + '\n' +
        'HTTP responce status code: ' + res.statusCode
      printError(msg)
      done(new Error(msg))
    } else {
      var content = ''
      res
        .on('end', function() {
          done(null, content)
        })
        .on('readable', function() {
          var chunk = res.read()
          content += chunk.toString()
        })
    }
  }

  try {
    require(url.indexOf('https') === 0 ? 'https' : 'http').get(url, receive).on('error', done)
  } catch (e) {
    done(e)
  }
}
function(url, done) {
  var receive = function(res) {
    if (res.statusCode != 200) {
      var msg = 'Failed to load ' + url + '\n' +
        'HTTP responce status code: ' + res.statusCode
      printError(msg)
      done(new Error(msg))
    } else {
      var content = ''
      res
        .on('end', function() {
          done(null, content)
        })
        .on('readable', function() {
          var chunk = res.read()
          content += chunk.toString()
        })
    }
  }

  try {
    require(url.indexOf('https') === 0 ? 'https' : 'http').get(url, receive).on('error', done)
  } catch (e) {
    done(e)
  }
}
function ( url , done ) { var receive = function ( res ) { if ( res . statusCode != 200 ) { var msg = 'Failed to load ' + url + '\n' + 'HTTP responce status code: ' + res . statusCode printError ( msg ) done ( new Error ( msg ) ) } else { var content = '' res . on ( 'end' , function ( ) { done ( null , content ) } ) . on ( 'readable' , function ( ) { var chunk = res . read ( ) content += chunk . toString ( ) } ) } } try { require ( url . indexOf ( 'https' ) === 0 ? 'https' : 'http' ) . get ( url , receive ) . on ( 'error' , done ) } catch ( e ) { done ( e ) } }
Downloads the script by remote url and provides its content as a
string to the callback

@param {String} url of the remote module to load
@param {Function} sCb success callback
@param {Function} fCb failure callback
Downloads the script by remote url and provides its content as a string to the callback