- About
- Features
- Installation
- Core Modules
- Advanced Usage
- Error Handling
- Examples
- Contributing
- License
Enplex.js is a versatile JavaScript library designed to simplify and enhance web development. It provides a unified interface for interacting with various APIs and services, empowering developers to build robust and innovative applications.
- AI Integration: Chat, image generation, and TTS capabilities - Under Maintenance
- Web Framework: Built-in Express-like web server
- Search APIs: YouTube, Spotify, and GitHub integration - Under Maintenance
- Discord Tools: Webhook and embed builder
- HTTP Client: Advanced request handling with retries
- Utilities: Validation, logging, and collections
- Event System: Built-in event emitter
- Queue Management: Task queue processing
- Code Execution: Safe code evaluation
npm install enplex.js@latest
const { NextChat } = require('enplex.js');
// Text Generation Example
const response = await NextChat.ask("What can you tell me about JavaScript?", {
model: "gemini",
cache: true
});
console.log(response);
// Image Generation Example
const image = await NextChat.imagine("A beautiful sunset over mountains", {
model: "prodia"
});
console.log(image);
// Text-to-Speech Example
const audio = await NextChat.tts("Welcome to Enplex.js!");
console.log(audio);
// Image Upscaling Example
const upscaled = await NextChat.upscale("https://example.com/image.jpg");
console.log(upscaled);
View All NextChat Features
<<<<<<< HEAD
- Supports multiple AI models:
4373eec0e4890a1e9409965d28881c518f952eb9
- Multiple Image Models:
- Animagen: Specialized in anime-style images
- Prodia: General purpose image generation
- Mage AI: Advanced image synthesis
- XL3: High-quality image generation
- Features:
- Natural voice synthesis
- Support for multiple languages
- Adjustable speech parameters
- Returns base64 encoded audio
- Capabilities:
- 4x upscaling
- Quality enhancement
- Noise reduction
- Detail preservation
- Built-in caching system
- 1-hour cache duration
- Automatic cache cleanup
- Memory-efficient storage
- Error handling
- Timeout protection (30s)
- Invalid input validation
- API error handling
- Performance optimizations
- Parallel processing
- Resource management
- Memory efficient
// Basic usage
const response = await NextChat.ask("What is JavaScript?", {
model: "gemini",
cache: true
});
// Available models
const models = [
"gpt4o", "gemini", "llama-vision",
"gemma2-9b", "gemma-7b", "groq-70b",
"groq-8b", "llama3-70b", "llama3-8b",
"llama3-1b", "llama3-3b", "llama3-11b",
"llama3-90b", "llama-guard"
];
// Generate image
const image = await NextChat.imagine("sunset over mountains", {
model: "prodia"
});
// Available models
const imgModels = ["animagen", "prodia", "mageai", "xl3"];
// Convert text to speech
const audio = await NextChat.tts("Hello World");
// Upscale images
const upscaled = await NextChat.upscale(imageUrl);
const { Search } = require('enplex.js');
// YouTube Search Example
const videos = await Search.yt("programming tutorials");
console.log(videos);
// GitHub Search Example
const repos = await Search.github("javascript libraries");
console.log(repos);
// Pinterest Search Example
const pins = await Search.pin("web design inspiration");
console.log(pins);
// Combined Search Example
async function searchAllPlatforms(query) {
const [videos, repos, images] = await Promise.all([
Search.yt(query),
Search.github(query),
Search.pin(query)
]);
return { videos, repos, images };
}
View All Search Features
- Features:
- Video search with metadata
- Channel information
- View counts and ratings
- Video duration
- Thumbnail URLs
- Capabilities:
- Repository search
- Code search
- User profiles
- Star counts
- Language statistics
- Features:
- Image search
- Board discovery
- Pin metadata
- Creator information
- Related pins
- Features:
- High-quality stock photos
- Photographer credits
- Image dimensions
- Download URLs
- License information
- Capabilities:
- HD wallpapers
- Multiple resolutions
- Categories
- Author information
- Download links
- Features:
- Anime-specific wallpapers
- Character tags
- Series information
- Resolution options
- Artist credits
- Rate limiting protection
- Error handling
- Response caching
- JSON formatted responses
- Pagination support
// YouTube Search
const videos = await Search.yt("coding tutorials");
// GitHub Repositories
const repos = await Search.github("javascript libraries");
// Pinterest Images
const pins = await Search.pin("web design inspiration");
// Pexels Photos
const photos = await Search.pexels("nature");
// Wallpapers
const wallpapers = await Search.wallpaper("abstract");
// Anime Wallpapers
const animeWalls = await Search.animeWallpaper("naruto");
Each search method returns a JSON response with relevant results from the respective platform.
const { Rectify } = require('enplex.js');
const app = new Rectify();
// Middleware
app.use(Rectify.bodyParser);
app.use(Rectify.cors);
// Routes
app.get("/", (req, res) => {
res.json({ message: "Hello World" });
});
app.listen(3000);
const { DiscordWebHook } = require('enplex.js');
const webhook = new DiscordWebHook({
id: "WEBHOOK_ID",
token: "WEBHOOK_TOKEN"
});
// Send Message
await webhook.send("Hello Discord!");
// Send Embed
const embed = await DiscordWebHook.createEmbed({
title: "Hello",
description: "This is an embed"
});
await webhook.send({ embeds: [embed] });
const { Collection } = require('enplex.js');
const collection = new Collection();
collection.set('key', 'value');
// Advanced Methods
const filtered = collection.filter(item => item.includes('value'));
const mapped = collection.map(item => item.toUpperCase());
const random = collection.random();
const { Validator } = require('enplex.js');
Validator.isEmail("user@example.com"); // true
Validator.isURL("https://example.com"); // true
Validator.isJSON('{"key": "value"}'); // true
const { Xio } = require('enplex.js');
const response = await Xio.request("https://api.example.com", {
method: "POST",
body: { key: "value" },
retry: {
maxAttempts: 3,
delay: 1000
}
});
View Error Handling Examples
try {
const response = await NextChat.ask("Question");
} catch (error) {
Logger.error(`AI Error: ${error.message}`);
}
// Handle empty inputs
try {
await NextChat.ask("");
} catch (error) {
// Throws: "NextChat Error: Empty prompt"
}
// Handle invalid models
try {
await NextChat.ask("Hello", { model: "invalid" });
} catch (error) {
// Throws: "NextChat Error: Invalid model"
}
try {
await NextChat.imagine("prompt", { timeout: 5000 });
} catch (error) {
// Handle timeout or network errors
Logger.error(`Network Error: ${error.message}`);
}
const { Rectify, Logger } = require('enplex.js');
const app = new Rectify();
// Middleware
app.use(Rectify.bodyParser);
app.use(Rectify.cors);
app.use(Rectify.compression);
// Routes
app.get("/", (req, res) => res.send("Welcome"));
app.post("/api/data", (req, res) => res.json(req.body));
// Error Handler
app.useErrorHandler((error, req, res) => {
Logger.error(error.message);
res.status(500).json({ error: "Server Error" });
});
app.listen(3000, () => {
Logger.info("Server running on port 3000");
});
const { NextChat, Logger } = require('enplex.js');
async function generateContent() {
try {
// Generate text
const text = await NextChat.ask("Describe a mountain landscape");
// Generate matching image
const image = await NextChat.imagine(text);
return { text, image };
} catch (error) {
Logger.error(`Generation failed: ${error.message}`);
throw error;
}
}
- Fork the project on GitHub
- Create your feature branch
- Commit your changes
- Push to your fork
- Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Made with β€οΈ by the OpenDevsFlow Team