UNPKG

pterodactyl-manager

Version:

A powerful and easy-to-use API wrapper for Pterodactyl's API, providing a seamless integration of server management and user administration functionalities.

16 lines (14 loc) 580 B
const getServer = require('../Servers/getServer'); module.exports = async function createFolder(url, headers, query, apiKey, filePath, fileContent) { try { const server = await getServer(url, headers, query) const response = await fetch(`${url}/api/client/servers/${server.attributes.identifier}/files/write?file=${filePath}`, { method: "POST", headers: {...headers, Authorization: `Bearer ${apiKey}`}, body: fileContent }); return await response.text() } catch (err) { console.log(err); } };