UNPKG

ffmpeg-toolkit

Version:

A modern FFmpeg toolkit for Node.js

104 lines (73 loc) โ€ข 1.62 kB
# Example Module A modern Node.js module template with TypeScript. ## Features - ๐Ÿš€ TypeScript support - ๐Ÿ“ฆ ESM and CommonJS support - ๐Ÿงช Vitest for testing - ๐Ÿ“ ESLint + Prettier for code quality - ๐Ÿ”„ Husky + lint-staged for git hooks - ๐Ÿ“š Zod for runtime type validation - ๐Ÿ› ๏ธ esbuild for fast builds ## Installation ```bash npm install @your-username/example-module ``` ## Usage ```typescript import { Module, module } from "@your-username/example-module"; // Use default instance const result = await module.operation("test"); console.log(result); // Or create custom instance const customModule = new Module({ debug: true, retries: 5, timeout: 10000 }); const customResult = await customModule.operation("test"); console.log(customResult); ``` ## API ### Module Main class for module functionality. #### Constructor ```typescript new Module(config?: Partial<Config>) ``` #### Methods - `getConfig(): Config` - Get current configuration - `updateConfig(config: Partial<Config>): void` - Update configuration - `operation<T>(input: T): Promise<Result<T>>` - Perform an operation ### Types ```typescript interface Config { debug: boolean; timeout: number; retries: number; } interface Result<T> { success: boolean; data?: T; error?: ModuleError; } class ModuleError extends Error { constructor(message: string, code: string); } ``` ## Development ```bash # Install dependencies npm install # Run tests npm test # Run tests with coverage npm run test:coverage # Build npm run build # Lint npm run lint # Format code npm run format ``` ## License MIT