
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
piston-api-client
Advanced tools
Client wrapper for the Piston Code Execution Engine API.
Inspired by node-piston.
pnpm add piston-api-client
yarn add piston-api-client
npm i piston-api-client
import { PistonClient } from 'piston-api-client';
// or for node.js
import { NodePistonClient as PistonClient } from 'piston-api-client';
(async () => {
const pistonClient = new PistonClient({ server: 'https://emkc.org' /* default */ });
const runtimes = await pistonClient.runtimes();
if (runtimes.success) {
console.log(runtimes.data);
// [
// {
// "language": "typescript",
// "version": "1.7.5",
// "aliases": [
// "deno-ts",
// "deno"
// ],
// "runtime": "deno"
// },
// ...
// ]
}
const result = await pistonClient.execute({
language: 'node-js',
version: '*',
files: [
{
content: 'console.log(process.argv.slice(2))',
},
],
args: ['Hello', 'World'],
});
if (result.success) {
console.log(result.data);
// {
// "run": {
// "stdout": "[ 'Hello', 'World' ]\n",
// "stderr": "",
// "code": 0,
// "signal": null,
// "output": "[ 'Hello', 'World' ]\n"
// },
// "language": "javascript",
// "version": "16.3.0"
// }
}
})();
import axios from 'axios';
import { AbstractPistonClient } from 'piston-api-client';
export class PistonClient extends AbstractPistonClient {
get(url, options) {
return axios.get(url, options).then((response) => response.data);
}
post(url, data, options) {
return axios.post(url, data, options).then((response) => response.data);
}
}
If an error occurs, the success property will be false and the error property will contain the error. Nothing will be thrown.
FAQs
Client wrapper for the Piston Code Execution Engine API
We found that piston-api-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.