pterodactyl.ts

Known Vulnerabilities Build Status Publish Package to npm and github

Pterodactyl.ts

This is a easy to use typescript based api wrapper for the pterodactyl api.

Quick start

Most functions are tested, if something doesn't work please open an issue on github.

With the ApplicationClient you can manage servers, nodes, users, and more.

import { ApplicationClient } from 'pterodactyl.ts';
const applicationClient = new ApplicationClient({
apikey: '',
panel: '',
});

Documentation

With the ApplicationClient you can manage servers, subusers, backups, files and more.

import { UserClient } from 'pterodactyl.ts';
const userClient = new UserClient({
apikey: '',
panel: '',
});
// Get a specific server from your account
import { SocketEvent } from 'pterodactyl.ts';
const server = await userClient.getServer('someId');

/**
* Console connection
*/
// The authentication is done automatically
const socket = await server.getConsoleSocket();
await socket.connect(true);

// Get the logs, when the server is offline you'll receive a generated log message
const logs = await socket.getLogs();

// Get live console logging
socket.on(SocketEvent.CONSOLE_OUTPUT, (log) => {
console.log(log);
});

socket.disconnect();

/**
* File management
*/
// Accepts a filepath, buffer or blob
await server.uploadFile('/', 'hello.world', 'hello.world');

Documentation

Use is at own risk!
You can easily delete everything - be cautious!