n-get

Enterprise-grade download tool built for AI agents with structured output, enhanced error handling, and intelligent configuration management

⚡ Parallel Downloads 🔄 Smart Resume 🔒 SSH/SFTP Support 📊 Structured Output 🛡️ Enhanced Errors 🔍 Capabilities Discovery 🤖 AI-Native Design 📝 Rich Metadata 🌐 Unix Pipes 🎨 Rich UI

Features

Unleash the Power of Smart Download Management

Parallel Downloads

Download multiple files simultaneously with configurable concurrency limiting for optimal performance

📊 Smart Concurrency

Intelligent queue management with semaphore-based concurrency control and resource pooling

🔄 Enhanced Resume

Intelligent resumption with numbered selection, batch resume, and HTTP range requests

🎯 Custom Destination

Specify where to save downloaded files with flexible path resolution

🎨 Beautiful UI

Rich UTF-8 emojis, colored output, and animated progress bars for enhanced user experience

📊 Real-time Progress

Live progress tracking with download speed and ETA calculations

🔒 SSH/SFTP Support

Secure file downloads via SSH with key authentication and resume capability

Unix Pipes Support

Full stdin/stdout support for seamless integration with shell pipes and command chaining

🔍 Recursive Downloads

Website mirroring with depth control, pattern matching, and robots.txt support

📝 Smart File Naming

Automatic file deduplication with incremental naming (file.zip, file.zip.1, file.zip.2)

⚙️ Enterprise Configuration

YAML-based hierarchical configuration with validation, profiles, and environment-specific settings

🤖 AI-Native Design

Built specifically for AI agents with structured output, contextual tracking, and framework integration

📊 Structured Output

JSON, YAML, CSV output formats for seamless AI agent integration and data processing

🛡️ Enhanced Error Handling

Structured error codes with severity levels, categories, and actionable recovery suggestions

🔍 Capabilities Discovery

Machine-readable tool capabilities for AI frameworks to understand and integrate features

📝 Rich Metadata Collection

Content-type detection, checksums, performance metrics, and contextual information for analysis

🔗 Contextual Tracking

Session, request, and conversation IDs for multi-turn AI agent interactions and operation correlation

Enterprise Configuration Management

Powerful YAML-based configuration system with validation, profiles, and hot-reloading

🏗️ Hierarchical Configuration

Multi-layer configuration with precedence: CLI args > env vars > local.yaml > environment.yaml > default.yaml

Schema Validation

Joi-powered validation ensures configuration integrity with type checking and constraint enforcement

Hot Reloading

Automatic configuration reloading in development mode when YAML files change

🎯 Performance Profiles

Pre-configured profiles for different scenarios: fast, secure, bulk, and careful downloading

🌍 Environment Support

Separate configurations for development, production, staging, and testing environments

📊 Metrics & Monitoring

Built-in configuration metrics, history tracking, and performance monitoring

Example Configuration Structure

# config/default.yaml - Base configuration
version: "2.0.0"
http:
  timeout: 30000
  maxRetries: 3
  maxConnections: 20
  userAgent: "N-Get-Enterprise/2.0"

downloads:
  maxConcurrent: 3
  enableResume: true
  progressReporting: true

security:
  maxFileSize: 10737418240  # 10GB
  allowedProtocols: ["https", "http", "sftp"]
  certificateValidation: true

profiles:
  fast:
    description: "Optimized for speed and high throughput"
    http:
      maxConnections: 50
      timeout: 15000
    downloads:
      maxConcurrent: 10
  
  secure:
    description: "Maximum security settings"
    security:
      allowedProtocols: ["https"]
      blockPrivateNetworks: true
      certificateValidation: true

# Environment variables: NGET_HTTP_TIMEOUT=45000
# CLI overrides: --config-downloads-maxconcurrent 5

AI Agent Integration

Purpose-built for AI agents with MCP server support and dynamic configuration

🔌 MCP Server Support

Compatible with Model Context Protocol (MCP) for seamless AI agent integration

⚙️ Dynamic Configuration

AI agents can dynamically switch profiles and adjust settings based on task requirements

📈 Learning Capabilities

Optional learning from successful downloads to optimize future configuration choices

🎛️ Agent-Controlled

No autonomous decisions - AI agents maintain full control over configuration and behavior

AI Agent Integration Examples

// AI Agent using n-get with ConfigManager
const { ConfigManager } = require('n-get/lib/config/ConfigManager');
const recursivePipe = require('n-get/lib/recursivePipe');

// Initialize configuration for AI agent
const configManager = new ConfigManager({
  environment: 'production',
  logger: myAILogger
});

// Get available profiles for AI decision making
const profiles = configManager.getAvailableProfiles();
console.log('Available profiles:', Object.keys(profiles));

// AI agent decides to use 'fast' profile for bulk download
await configManager.applyProfile('fast');

// Get AI-optimized configuration summary
const summary = configManager.getAIConfigSummary();
console.log('Current settings:', summary.keySettings);

// Download files with AI-configured settings
const results = await recursivePipe(urls, destination, {
  configManager,
  maxConcurrent: summary.keySettings.maxConcurrentDownloads
});

// Learn from successful outcome
configManager.learnFromOutcome({
  success: true,
  duration: 30000,
  throughput: 5242880,
  errors: {}
});

// Export data for AI model training
const trainingData = configManager.exportForAITraining();

MCP Server Integration

# Enable MCP server support
export NGET_AI_MCP_ENABLED=true
export NGET_AI_MCP_PORT=8080

# AI agent can now use configuration profiles
nget --config-ai-profile fast https://example.com/files.zip

# Environment-specific configuration for AI
nget --config-environment production --config-ai-profile secure

CrewAI / AutoGen / LangChain Integration

# Python AI agent using n-get via subprocess
import subprocess
import json

class NGetTool:
    def __init__(self):
        self.config_profiles = {
            'fast': 'Optimized for speed and high throughput',
            'secure': 'Maximum security settings',
            'bulk': 'Designed for large batch downloads',
            'careful': 'Conservative settings for unreliable connections'
        }
    
    def download_files(self, urls, profile='fast', destination='./downloads'):
        """Download files using n-get with specified profile"""
        cmd = [
            'nget',
            '--config-ai-profile', profile,
            '--config-environment', 'production',
            '-d', destination
        ] + urls
        
        result = subprocess.run(cmd, capture_output=True, text=True)
        return {
            'success': result.returncode == 0,
            'output': result.stdout,
            'error': result.stderr
        }
    
    def get_available_profiles(self):
        """Get available configuration profiles"""
        return self.config_profiles

# Usage in CrewAI agent
agent = Agent(
    role='Download Manager',
    goal='Efficiently download files based on requirements',
    tools=[NGetTool()],
    backstory='Expert in optimizing download performance'
)

Architecture & Patterns

Modern Node.js design patterns with separation of concerns and modular architecture

📁 Project Structure

n-get/ ├── index.js # CLI entry point & argument parsing ├── lib/ │ ├── recursivePipe.js # Core download logic using streams │ ├── uriManager.js # URL validation & protocol handling │ ├── resumeManager.js # Resume functionality & metadata │ ├── sftpManager.js # SSH/SFTP download support │ ├── ui.js # Enhanced UI with progress bars │ ├── chdir.js # Directory operations │ ├── recursiveDownloader.js # Website mirroring │ └── config/ # Enterprise configuration system │ └── ConfigManager.js # YAML config with validation ├── config/ # Configuration files │ ├── default.yaml # Base configuration │ ├── development.yaml # Development overrides │ ├── production.yaml # Production settings │ └── local.yaml # Local overrides (git-ignored) ├── docs/ # AI integration documentation │ └── AI_AGENT_INTEGRATION.md # AI agent usage guide ├── test/ # Comprehensive test suite ├── package.json # Dependencies & CLI configuration └── README.md # Documentation

🏗️ Design Patterns

  • Module Pattern: Each file exports specific functionality with clear interfaces
  • Stream Processing: Uses Node.js streams for memory-efficient file downloads
  • Promise-based API: Modern async/await patterns throughout
  • Separation of Concerns: CLI, validation, and download logic are decoupled

⚡ Core Components

  • CLI Layer: Command-line interface with argument parsing
  • URI Manager: URL validation and protocol normalization
  • Download Engine: Stream-based file downloading with progress tracking
  • Resume Manager: Intelligent resume with metadata and validation
  • SFTP Manager: SSH/SFTP secure download support
  • UI Manager: Enhanced terminal UI with progress bars

🔧 Technical Stack

  • Runtime: Node.js >= 18.0.0
  • HTTP Client: node-fetch (modern replacement for request)
  • SSH/SFTP: ssh2 and ssh2-sftp-client for secure downloads
  • Configuration: js-yaml for YAML parsing, Joi for validation
  • UI: cli-progress and colors for enhanced user experience
  • Streams: Native Node.js streams for memory efficiency
  • AI Integration: MCP compatible, supports CrewAI, AutoGen, LangChain

Installation

Get started with n-get in seconds

📦 Global Installation (Recommended)

npm install n-get -g

🔧 From Source

git clone https://github.com/bingeboy/n-get cd n-get npm install npm link # For global access

Usage Examples

Simple and intuitive command-line interface

# Download a single file
nget https://example.com/file.zip

# Download to specific directory
nget https://example.com/file.zip -d /path/to/destination

# Download multiple files
nget https://example.com/file1.zip https://example.com/file2.pdf -d ./downloads

Programmatic API

Use n-get as a module in your Node.js applications

const recursivePipe = require('n-get/lib/recursivePipe');
const ConfigManager = require('n-get/lib/config/ConfigManager');

// Basic usage without configuration
recursivePipe(['https://example.com/file.zip'], './downloads')
  .then(results => {
    console.log('Download results:', results);
  })
  .catch(error => {
    console.error('Download failed:', error);
  });

// Advanced usage with ConfigManager (Enterprise features)
const configManager = new ConfigManager({
  environment: 'production',
  enableHotReload: false
});

// Apply AI profile for optimized downloads
await configManager.applyProfile('fast');

// Get AI-optimized settings
const summary = configManager.getAIConfigSummary();
console.log('Using settings:', summary.keySettings);

// Download with enterprise configuration
const options = {
  configManager,
  maxConcurrent: summary.keySettings.maxConcurrentDownloads,
  enableResume: true,
  quietMode: false
};

recursivePipe([
  'https://example.com/file1.zip',
  'https://example.com/file2.pdf',
  'https://example.com/file3.jpg'
], './downloads', options)
  .then(results => {
    console.log(`Downloaded ${results.length} files`);
    results.forEach(result => {
      console.log(`${result.success ? '✅' : '❌'} ${result.url}`);
    });
    
    // Learn from successful outcome for AI optimization
    if (results.every(r => r.success)) {
      configManager.learnFromOutcome({
        success: true,
        duration: Date.now() - startTime,
        throughput: calculateThroughput(results),
        errors: {}
      });
    }
  });

// Configuration management examples
const profiles = configManager.getAvailableProfiles();
console.log('Available profiles:', Object.keys(profiles));

// Export configuration for AI training
const trainingData = configManager.exportForAITraining();
console.log('Training data collected:', trainingData.history.length, 'events');