xytro.js
v0.0.2-beta
Published
your go-to multipurpose npm package designed to simplify development tasks
Downloads
125
Maintainers
Keywords
Readme
Introduction
Welcome to Xytro.js, your go-to multipurpose npm package designed to simplify development tasks. If you encounter any issues or need assistance, feel free to reach out on Discord: koushik0p
(ID: 1050641070368772166
).
Key Features
- NextChat: Effortlessly interact with a range of AI models without requiring an API key.
const { nextchat } = require("xytro.js");
(async () => {
const options = {
model: "bard", // Options: bard, gemini, gpt, gpt4, llama, codellama, mixtral
cache: true // Enable caching for faster responses
};
const resp = await nextchat.ask("Hello, what's your name?", options);
console.log(resp);
})();
const { nextchat } = require("xytro.js");
(async () => {
const resp = await nextchat.prodia("a cute cat");
console.log(resp); // Output as .url or .base64
})();
const { nextchat } = require("xytro.js");
// DALLE-E Mini
(async () => {
const options = {
prompt: "cat"
}
const resp = await nextchat.dalle(options);
console.log(resp);
})();
// DALL-E 2
(async () => {
const options = {
prompt: "cat"
}
const resp = await nextchat.dalle2(options);
console.log(resp);
})();
// DALL-E 3
(async () => {
const options = {
prompt: "cat",
negative_prompt: "blurry, bad quality.", // optional
width: 512, // optional
height: 512, // optional
guidance_scale: 7.5 // optional
}
const resp = await nextchat.dalle3(options);
console.log(resp);
})();
- Search: Search on platforms like YouTube and Spotify.
const { search } = require("xytro.js");
(async () => {
const data = await search.yt("Techno Gamerz"); // search on YouTube
console.log(data);
})();
const { search } = require("xytro.js");
(async () => {
const data = await search.sp("Game On"); // search on Spotify
console.log(data);
})();
const { search } = require("xytro.js");
(async () => {
const data = await search.px("Nature"); // search on Pexels
console.log(data);
})();
- NsfwFilter: Accurately detect NSFW content from images.
const { nsfwfilter } = require("xytro.js");
(async () => {
const resp = await nsfwfilter.detect("Your_Image_URL"); // Pass image URL
if (resp.isNsfw) {
console.log("NSFW content detected");
} else {
console.log("Content is safe");
}
})();
- Readline: Develop interactive CLI tools with ease.
const { Readline } = require("xytro.js");
const rl = new Readline();
function askName() {
rl.question('What is your name? ', (name) => {
console.log(`Hello, ${name}!`);
rl.close();
});
}
askName();
- Rectify: Build web applications with an optimized, Express.js-like framework.
const { Rectify } = require('xytro.js');
const path = require('path');
const app = new Rectify();
// Middleware example: Logs all requests
app.use(async (req, res, next) => {
console.log(`${req.method} ${req.url}`);
next();
});
// Route: GET /
app.route('GET', '/', async (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end('<h1>Welcome to Rectify Server</h1>');
});
// Route: GET /user/:id
app.route('GET', '/user/:id', async (req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ userId: req.params.id }));
});
// Static files: Serve files from the public directory
app.serveStatic(path.join(__dirname, 'public'));
// Start the server on port 3000
app.listen(3000);
Support
Need help? Join our Discord Community for support, discussions, and updates.