0.2.3 • Published 11 years ago
paiza-io v0.2.3
node-paiza-io
paiza.io API unofficial wrapper - you can run any language on Node.js!
Thank paiza.io for providing such greatest API!!
notice for using
this package uses paiza.io's API. so please read term of use (Japanese only)!
install
$ npm install --save paiza-iousing
run Ruby on Node.js.
var
paiza_io = require('paiza-io');
paiza_io('ruby', 'puts "Hello, Ruby World!"', '', function (error, result) {
if (error) throw error;
console.log('ruby result:');
console.log(result.stdout); //=> Hello, Ruby World!
});run Python on Node.js.
var
paiza_io = require('paiza-io');
paiza_io('python', 'print "Hello, Python World!"', '', function (error, result) {
if (error) throw error;
console.log('python result:');
console.log(result.stdout); //=> Hello, Python World!
});run C++ on Node.js.
var
paiza_io = require('paiza-io');
paiza_io('cpp', [
'#include <iostream>',
'int main(void) {',
' std::cout << "Hello, C++ World!" << std::endl;',
'}',
].join('\n'), '', function (error, result) {
if (error) throw error;
console.log('c++ result:');
console.log(result.stdout); //=> Hello, C++ World!
});api
you may want to read official API document with this.
paiza_io(lang, code, input, option, callback)
arguments
langis language name. it will be passed aslanguageparameter to runners/create.codeis source code. it will be passed assource_codeparameter to runners/create.inputis stdin text. it will be passed asinputparameter to runners/create.optionis a json. it is an optional argument. it follws such keys/values.option.api_keyis your API key of paiza-io. it will be passed asapi_keyparameter to all request.option.base_urluses as base URL for API request.option.max_get_status_loopis max number of runners/get_status request for checking completed running. If requests number is overflow this,paiza_iothrows an error.option.retry_get_status_timeis a time of retrying runners/get_status.option.parameterwill be passed to runners/create.
callbackis aFunctionwhose signature isfunction callback(error, result).resultis result json of runners/get_details, however it is extended byhttp_resultparameter which is http response of runners/get_details.
returns
it dosen't return clearly, so its result is undefined.
paiza_io.with_api_key(api_key)
arguments
api_keyis your API key of paiza-io. it will be passed asapi_keyparameter to all request.
returns
it returns wrapped paiza_io function.
license
this package was published under the MIT-License.
contribute
if this package has a bug and you fix it, i am waiting your pull-request and issue :laughing:
