@buu-js/buu-js
v0.9.9
Published
Zero-dependency NPM package maximizing latest Node.js 25.2.0+ capabilities
Downloads
13
Maintainers
Readme
🚀 BuuJS
Honneybuu Modz Zero-dependency NPM package maximizing Node.js 25.2.0+ capabilities
🚀 Node.js 25.2.0+ Exclusive Features
- Scheduler API:
scheduler.wait(),scheduler.yield()for precise async control - Event Loop Monitoring:
monitorEventLoopDelay()with detailed performance analysis - Performance Histograms:
createHistogram()for ultra-precise benchmarking - Enhanced System Info:
machine(),availableParallelism(), enhanceduserInfo() - Advanced Crypto: KeyObject support, scrypt optimizations, enhanced WebCrypto
- Stream Compose: New
compose()API for stream pipeline optimization - MessageChannels:
markAsUntransferable(),receiveMessageOnPort() - Util Functions:
parseArgs(),styleText(),getSystemErrorName()
✨ Features
🔥 Node.js 25.2.0+ Features - Utilizes the latest Node.js capabilities
⚡ Zero Dependencies - Pure Node.js, no external packages
🚀 Ultra Performance - Maximized for Node.js 25.2.0+ speed
🔧 TypeScript Ready - Complete type definitions included
🎯 ES Modules - Modern import/export syntax
🧪 100% Test Coverage - Comprehensive testing suite
📊 Performance Monitoring - Real-time benchmarking tools
🔐 Advanced Crypto - Enhanced cryptographic utilities
🌊 Stream Processing - High-performance stream operations
📦 Installation
npm install @buu-js🚀 Quick Start
import BuuJS from '@buu-js';
// Get system information
console.log(BuuJS.info());
// High-performance async iteration
for await (const num of BuuJS.AsyncIterator.range(0, 10)) {
console.log(num);
}
// Lightning-fast crypto operations
const hash = BuuJS.Crypto.hash('Hello World');
const uuid = BuuJS.Crypto.uuid();
// Performance benchmarking
const result = await BuuJS.Perf.benchmark(() => {
// Your code here
}, 1000);
console.log(`Performance: ${result.opsPerSecond} ops/sec`);🎯 API Reference
🔄 AsyncIterator
// Generate number ranges
for await (const num of BuuJS.AsyncIterator.range(0, 100, 2)) {
console.log(num); // 0, 2, 4, 6...
}
// Chunk async iterables
for await (const chunk of BuuJS.AsyncIterator.chunk(someAsyncIterable, 5)) {
console.log(chunk); // Arrays of 5 items
}
// Parallel processing with concurrency control
for await (const result of BuuJS.AsyncIterator.parallel(asyncTasks, 4)) {
console.log(result);
}🔐 Crypto
// Hash data
const hash = BuuJS.Crypto.hash('data', 'sha256');
// Stream hashing
const streamHash = await BuuJS.Crypto.hashStream(readableStream);
// Generate UUIDs
const id = BuuJS.Crypto.uuid();
// Secure random bytes
const bytes = BuuJS.Crypto.randomBytes(32);
// Key derivation
const key = await BuuJS.Crypto.deriveKey('password', 'salt', 100000);⚡ Performance
// Mark performance points
BuuJS.Perf.mark('start');
// ... your code ...
BuuJS.Perf.mark('end');
// Measure performance
const measure = BuuJS.Perf.measure('operation', 'start', 'end');
// Benchmark functions
const stats = await BuuJS.Perf.benchmark(myFunction, 1000);
console.log(stats.opsPerSecond);
// Memory usage
const memory = BuuJS.Perf.memoryUsage();👷 Worker Threads
// Run function in worker thread
const result = await BuuJS.Worker.runInWorker((data) => {
return data * 2;
}, 42);
// Create worker pool
const pool = BuuJS.Worker.createWorkerPool(4);
const results = await Promise.all([
pool.execute(heavyTask, data1),
pool.execute(heavyTask, data2),
pool.execute(heavyTask, data3)
]);
pool.terminate();🌊 Streams
// Transform streams
const transformer = BuuJS.Stream.createTransform(data => data * 2);
// Async transform streams
const asyncTransformer = BuuJS.Stream.createAsyncTransform(async data => {
return await processData(data);
});
// Convert async iterables to streams
const stream = BuuJS.Stream.fromAsyncIterable(asyncIterable);
// Collect stream data
const data = await BuuJS.Stream.collect(stream);🔄 Async Utilities
// Delay execution
await BuuJS.Async.delay(1000);
// Timeout promises
const result = await BuuJS.Async.timeout(longRunningPromise, 5000);
// Retry with backoff
const data = await BuuJS.Async.retry(unstableFunction, 3, 1000);
// Async resource tracking
const resource = BuuJS.Async.createAsyncResource('MyResource');
await BuuJS.Async.withResource(resource, () => {
// Code runs in async context
});🧪 Testing
# Run tests
npm test
# Run benchmarks
npm run benchmark
# Start interactive mode
npm start📊 Performance
BuuJS is optimized for maximum performance with the latest Node.js features:
- Crypto operations: 100,000+ ops/sec
- UUID generation: 50,000+ ops/sec
- Async iteration: Highly optimized generators
- Memory efficient: Minimal heap usage
- Worker threads: Full CPU utilization
🎯 Node.js 25.2.0 Optimization
BuuJS is specifically optimized for Node.js 25.2.0 and later versions, utilizing the latest performance improvements, API enhancements, and modern JavaScript features available in the newest Node.js runtime.
📄 Requirements
- Node.js: 25.2.0 or higher (required for optimal performance)
- ES Modules: Required (
"type": "module") - Zero Dependencies: Pure Node.js only
🔧 TypeScript Support
Full TypeScript definitions included:
import BuuJS, { BuuCrypto, BuuPerf } from 'buujs';
const hash: string = BuuCrypto.hash('data');
const stats: BenchmarkResult = await BuuPerf.benchmark(() => {
// Your code
});🌟 Examples
Parallel Data Processing
import BuuJS from 'buujs';
async function processLargeDataset(data) {
const chunks = BuuJS.AsyncIterator.chunk(data, 100);
const results = [];
for await (const chunk of BuuJS.AsyncIterator.parallel(chunks, 4)) {
results.push(await processChunk(chunk));
}
return results;
}High-Performance Hashing
import BuuJS from 'buujs';
const stats = await BuuJS.Perf.benchmark(() => {
const data = BuuJS.Crypto.randomBytes(1024);
return BuuJS.Crypto.hash(data);
}, 10000);
console.log(`Hash performance: ${stats.opsPerSecond} ops/sec`);Worker Pool Processing
import BuuJS from 'buujs';
const pool = BuuJS.Worker.createWorkerPool(8);
const tasks = Array.from({ length: 100 }, (_, i) =>
pool.execute(heavyComputation, i)
);
const results = await Promise.all(tasks);
pool.terminate();📝 License
MIT © HonneybuuModzDevelopmentTeam
