sfiledl 2.0.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib.cjs +934 -98
- package/build/lib.cjs.map +1 -1
- package/build/lib.d.ts +144 -28
- package/build/lib.mjs +875 -80
- package/build/lib.mjs.map +1 -1
- package/changelog +200 -0
- package/package.json +11 -9
- package/readme.md +170 -0
- package/readme +0 -3
package/build/lib.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.mjs","sources":["../lib/lib.ts"],"sourcesContent":["/**\n * ====================================================================================================\n * WARNING: LIBRARY UNDER ACTIVE DEVELOPMENT - NOT FOR PRODUCTION USE\n * ====================================================================================================\n * \n * Status: DEPRECATED / UNSTABLE\n * Previous Version: 1.0.2 (CLI-based architecture)\n * Target Version: 2.0.1 (Full framework architecture)\n * \n * BREAKING CHANGES NOTICE:\n * - This library is undergoing a complete rewrite and architectural refactor.\n * - Legacy CLI-based implementation has been entirely removed.\n * - New framework-based architecture is currently under active development.\n * \n * PRODUCTION USE PROHIBITED:\n * - API surface is subject to change without notice.\n * - No backward compatibility guarantees.\n * - Use exclusively for development and testing purposes.\n * \n * ====================================================================================================\n */\n\n// ANSI color codes for terminal output\nconst COLORS = {\n RESET: \"\\x1b[0m\",\n BRIGHT: \"\\x1b[1m\",\n YELLOW: \"\\x1b[33m\",\n RED: \"\\x1b[31m\",\n CYAN: \"\\x1b[36m\",\n GRAY: \"\\x1b[90m\",\n} as const;\n\n/**\n * Development status of the library.\n */\nexport enum LibraryStatus {\n /** Library is under active construction, not ready for production. */\n UNDER_CONSTRUCTION = \"UNDER_CONSTRUCTION\",\n /** Library is stable and ready for production. (Future use) */\n STABLE = \"STABLE\",\n /** Library is deprecated. (Future use) */\n DEPRECATED = \"DEPRECATED\",\n}\n\n/**\n * Library metadata.\n */\nexport const LIB_INFO = {\n name: \"MySuperFramework\",\n currentVersion: \"2.0.1-dev\",\n previousVersion: \"1.0.2\",\n status: LibraryStatus.UNDER_CONSTRUCTION,\n isDeprecated: true,\n message: \"This version represents a complete architectural refactor from CLI to framework. Not stable.\",\n} as const;\n\n// Flag to ensure warning is displayed only once\nlet warningDisplayed = false;\n\n/**\n * Utility function to strip ANSI escape codes from a string.\n * Supports common ANSI sequences (colors, styles, etc.).\n * @param text - Text containing ANSI escape sequences.\n * @returns Plain text without ANSI formatting.\n */\nfunction stripAnsi(text: string): string {\n // Matches ANSI escape sequences: \\x1b[ (or \\u001b[) followed by any number of parameters and ending with a letter\n return text.replace(/\\x1b\\[[0-9;]*[a-zA-Z]/g, \"\");\n}\n\n/**\n * Checks if the library is currently in development mode.\n * @returns `true` if the library status is `UNDER_CONSTRUCTION`.\n */\nexport function isDevelopmentVersion(): boolean {\n return LIB_INFO.status === LibraryStatus.UNDER_CONSTRUCTION;\n}\n\n/**\n * Primary class for library status management and developer notifications.\n * Provides programmatic access to version information and stability checks.\n */\nexport class LibStatus {\n private static instance: LibStatus | undefined;\n\n private constructor() {\n this.displayDeveloperWarning();\n }\n\n /**\n * Gets the singleton instance of LibStatus.\n * @returns The LibStatus instance.\n */\n public static getInstance(): LibStatus {\n if (!LibStatus.instance) {\n LibStatus.instance = new LibStatus();\n }\n return LibStatus.instance;\n }\n\n /**\n * Outputs formatted warning message to console upon library initialization.\n * Uses ANSI color codes for enhanced visibility in terminal environments.\n * The warning is displayed only once per process, unless suppressed.\n */\n private displayDeveloperWarning(): void {\n // Skip if console is not available or warning already displayed\n if (typeof console === \"undefined\" || typeof console.warn !== \"function\") {\n return;\n }\n if (warningDisplayed) {\n return;\n }\n // Check environment variable to suppress warning (e.g., for testing)\n // Use bracket notation to avoid TypeScript index signature error\n if (typeof process !== \"undefined\" && process.env && process.env['MY_SUPER_FRAMEWORK_SUPPRESS_WARNING'] === \"true\") {\n return;\n }\n\n const border = `${COLORS.GRAY}${\"=\".repeat(80)}${COLORS.RESET}`;\n const label = `${COLORS.YELLOW}${COLORS.BRIGHT}[WARNING]${COLORS.RESET}`;\n const highlight = `${COLORS.CYAN}`;\n\n console.warn(`\\n${border}`);\n console.warn(`${label} DEVELOPMENT VERSION IN USE`);\n console.warn(`${COLORS.GRAY}Library: ${COLORS.RESET}${highlight}${LIB_INFO.name}${COLORS.RESET}`);\n console.warn(`${COLORS.GRAY}Current Version: ${COLORS.RESET}${highlight}${LIB_INFO.currentVersion}${COLORS.RESET}`);\n console.warn(`${COLORS.GRAY}Previous Version: ${COLORS.RESET}${highlight}${LIB_INFO.previousVersion}${COLORS.RESET}`);\n console.warn(`${COLORS.GRAY}Architecture: ${COLORS.RESET}${highlight}CLI -> Framework (Full Refactor)${COLORS.RESET}`);\n console.warn(`\\n${COLORS.RED}${COLORS.BRIGHT}DO NOT USE IN PRODUCTION ENVIRONMENTS${COLORS.RESET}`);\n console.warn(`${COLORS.GRAY}API stability is not guaranteed. Breaking changes may occur without notice.${COLORS.RESET}`);\n console.warn(`${COLORS.GRAY}To suppress this warning, set env MY_SUPER_FRAMEWORK_SUPPRESS_WARNING=true${COLORS.RESET}`);\n console.warn(`${border}\\n`);\n\n warningDisplayed = true;\n }\n\n /**\n * Suppresses the development warning for this instance.\n * Useful when you need to programmatically disable the warning (e.g., in tests).\n */\n public suppressWarning(): void {\n warningDisplayed = true;\n }\n\n /**\n * Validates library stability status.\n * @throws Error if library is marked as unstable or under construction.\n */\n public ensureStable(): void {\n if (LIB_INFO.status === LibraryStatus.UNDER_CONSTRUCTION) {\n const errorMessage = `${COLORS.RED}${COLORS.BRIGHT}[${LIB_INFO.name}] Stability Check Failed${COLORS.RESET}\\n` +\n `${COLORS.GRAY}Library version ${LIB_INFO.currentVersion} is under active development.${COLORS.RESET}\\n` +\n `${COLORS.GRAY}Current status: ${LIB_INFO.status}${COLORS.RESET}`;\n\n throw new Error(stripAnsi(errorMessage));\n }\n }\n\n /**\n * Returns the current library version string.\n * @returns Version identifier in semver format.\n */\n public getVersion(): string {\n return LIB_INFO.currentVersion;\n }\n\n /**\n * Returns detailed library metadata.\n * @returns Readonly object containing library information.\n */\n public getInfo(): Readonly<typeof LIB_INFO> {\n return LIB_INFO;\n }\n}\n\n/**\n * Placeholder entry point for framework initialization.\n * Intentionally throws error to prevent usage during development phase.\n * @throws Error indicating framework is not ready for use.\n */\nexport function initFramework(): never {\n const message = `${COLORS.RED}${COLORS.BRIGHT}[${LIB_INFO.name}] Initialization Blocked${COLORS.RESET}\\n` +\n `${COLORS.GRAY}Framework is undergoing complete architectural refactor.${COLORS.RESET}\\n` +\n `${COLORS.GRAY}Migration path: v${LIB_INFO.previousVersion} (CLI) -> v${LIB_INFO.currentVersion} (Framework)${COLORS.RESET}\\n` +\n `${COLORS.GRAY}Status: ${LIB_INFO.status}${COLORS.RESET}`;\n\n throw new Error(stripAnsi(message));\n}\n\n/**\n * Type guard to check if current version is stable.\n * @returns `false` if library is under construction, `true` otherwise.\n */\nexport function isStable(): boolean {\n return LIB_INFO.status !== LibraryStatus.UNDER_CONSTRUCTION;\n}\n\n/**\n * Throws an error if the library is not stable.\n * Use this at the start of your application to ensure you're not using an unstable version.\n * @throws Error when library is under construction.\n */\nexport function assertStable(): void {\n if (LIB_INFO.status === LibraryStatus.UNDER_CONSTRUCTION) {\n throw new Error(\n `[${LIB_INFO.name}] Cannot use unstable version ${LIB_INFO.currentVersion} in production. ` +\n `Status: ${LIB_INFO.status}`\n );\n }\n}\n\n// Immediate execution block: displays warning upon module import (only once)\n// Does not throw to allow type-checking and development workflows\nif (isDevelopmentVersion()) {\n // Trigger singleton instantiation which displays the warning\n LibStatus.getInstance();\n}"],"names":[],"mappings":"AAuBA,MAAM,MAAM,GAAG;AACb,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,MAAM,EAAE,UAAU;AAClB,IAAA,GAAG,EAAE,UAAU;AACf,IAAA,IAAI,EAAE,UAAU;AAChB,IAAA,IAAI,EAAE,UAAU;CACR;IAKE;AAAZ,CAAA,UAAY,aAAa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utils/helpers.ts","../lib/browser/browser-manager.ts","../lib/utils/logger.ts","../lib/config/schema.ts","../lib/core/validator.ts","../lib/core/downloader.ts","../lib/utils/result.ts"],"sourcesContent":["export abstract class AppError extends Error {\n\tpublic readonly timestamp: string\n\tpublic readonly context: Readonly<Record<string, unknown>>\n\tpublic readonly code: string\n\tpublic readonly retryable: boolean\n\tconstructor(\n\t\tmessage: string,\n\t\tcode: string,\n\t\tretryable: boolean = false,\n\t\tcontext?: Record<string, unknown>,\n\t) {\n\t\tsuper(message)\n\t\tthis.name = this.constructor.name\n\t\tthis.code = code\n\t\tthis.retryable = retryable\n\t\tthis.timestamp = new Date().toISOString()\n\t\tthis.context = context ? Object.freeze({ ...context }) : Object.freeze({})\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, this.constructor)\n\t\t}\n\t\tObject.freeze(this)\n\t}\n\ttoJSON(): Record<string, unknown> {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tcode: this.code,\n\t\t\tmessage: this.message,\n\t\t\tretryable: this.retryable,\n\t\t\ttimestamp: this.timestamp,\n\t\t\tcontext: this.context,\n\t\t\tstack: process.env['NODE_ENV'] === 'development' ? this.stack : undefined,\n\t\t}\n\t}\n\ttoString(): string {\n\t\treturn `${this.name} [${this.code}]: ${this.message}`\n\t}\n\tisCode(code: string): boolean {\n\t\treturn this.code === code\n\t}\n\tisRetryable(): boolean {\n\t\treturn this.retryable\n\t}\n}\n","import { AppError } from './base.js'\nexport class ValidationError extends AppError {\n\tconstructor(message: string, context?: Record<string, unknown>) {\n\t\tsuper(message, 'VALIDATION_ERROR', false, context)\n\t\tObject.freeze(this)\n\t}\n}\nexport class NetworkError extends AppError {\n\tconstructor(message: string, context?: Record<string, unknown>) {\n\t\tsuper(message, 'NETWORK_ERROR', true, context)\n\t\tObject.freeze(this)\n\t}\n}\nexport class FileError extends AppError {\n\tconstructor(message: string, context?: Record<string, unknown>) {\n\t\tsuper(message, 'FILE_ERROR', false, context)\n\t\tObject.freeze(this)\n\t}\n}\nexport class BrowserError extends AppError {\n\tconstructor(message: string, context?: Record<string, unknown>) {\n\t\tsuper(message, 'BROWSER_ERROR', true, context)\n\t\tObject.freeze(this)\n\t}\n}\nexport function isAppError(err: unknown): err is AppError {\n\treturn err instanceof AppError\n}\nexport function isRetryableError(err: unknown): boolean {\n\treturn isAppError(err) && err.retryable\n}\nexport function isErrorWithCode(err: unknown, code: string): boolean {\n\treturn isAppError(err) && err.code === code\n}\n","export const DEFAULTS = {\n\tuserAgent:\n\t\t'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',\n\theadless: true,\n\ttimeout: 60000,\n\tdownloadButtonTimeout: 30000,\n\tfallbackWaitMs: 3000,\n\tretries: 3,\n\tretryDelay: 1000,\n\tmaxRetryDelay: 30000,\n\tsaveDebugArtifacts: true,\n\tmaxFilenameLength: 255,\n\tsanitizeReplacement: '_',\n} as const\nexport type Defaults = typeof DEFAULTS\n","import { Page } from 'playwright'\nimport { Logger } from '../utils/logger.js'\nimport { NetworkError } from '../errors/index.js'\nexport class SfilePageInteractions {\n\tconstructor(\n\t\tprivate page: Page,\n\t\tprivate logger: Logger,\n\t) {}\n\tasync waitForDownloadButton(timeout: number): Promise<void> {\n\t\tthis.logger.debug('Waiting for #download button', { timeout })\n\t\tconst button = this.page.locator('#download')\n\t\tawait button.waitFor({ state: 'visible', timeout })\n\t\tthis.logger.debug('Button is visible, checking if active')\n\t\tawait this.page.waitForFunction(\n\t\t\t() => {\n\t\t\t\tconst btn = document.querySelector('#download') as HTMLAnchorElement | null\n\t\t\t\tif (!btn) return false\n\t\t\t\tconst href = btn.getAttribute('href')\n\t\t\t\tconst style = window.getComputedStyle(btn)\n\t\t\t\tconst isDisabled =\n\t\t\t\t\tbtn.hasAttribute('disabled') ||\n\t\t\t\t\tbtn.getAttribute('aria-disabled') === 'true' ||\n\t\t\t\t\tbtn.classList.contains('disabled')\n\t\t\t\treturn !!(\n\t\t\t\t\thref &&\n\t\t\t\t\thref !== '#' &&\n\t\t\t\t\thref.trim() !== '' &&\n\t\t\t\t\tstyle.pointerEvents !== 'none' &&\n\t\t\t\t\t!isDisabled\n\t\t\t\t)\n\t\t\t},\n\t\t\t{ timeout },\n\t\t)\n\t\tthis.logger.debug('Download button is active and ready')\n\t}\n\tasync extractIntermediateUrl(): Promise<string> {\n\t\tthis.logger.debug('Extracting href from #download button')\n\t\ttry {\n\t\t\tconst href = await this.page.$eval('#download', (el) => {\n\t\t\t\tconst anchor = el as HTMLAnchorElement\n\t\t\t\treturn anchor.href\n\t\t\t})\n\t\t\tif (!href || href === '#' || href.trim() === '') {\n\t\t\t\tthrow new NetworkError('Download button href is empty or invalid', { href })\n\t\t\t}\n\t\t\treturn href\n\t\t} catch (err: unknown) {\n\t\t\tif (err instanceof Error && err.message?.includes('Element not found')) {\n\t\t\t\tthrow new NetworkError('Download button (#download) not found in page', {\n\t\t\t\t\tselector: '#download',\n\t\t\t\t\toriginalError: err.message,\n\t\t\t\t})\n\t\t\t}\n\t\t\tthrow err\n\t\t}\n\t}\n}\n","export function sanitizeFilename(name: string, replacement = '_'): string {\n\tconst safeName = name.replace(/\\.\\.[\\\\/]/g, '')\n\tconst sanitized = safeName\n\t\t.replace(/[<>:\"/\\\\|?*\\x00-\\x1F]/g, replacement)\n\t\t.replace(new RegExp(`${replacement}+`, 'g'), replacement)\n\t\t.trim()\n\tconst maxLength = 255\n\tconst trimmed = sanitized.slice(0, maxLength)\n\treturn trimmed || `file${replacement}bin`\n}\nexport const sleep = (ms: number): Promise<void> =>\n\tnew Promise((resolve) => setTimeout(resolve, ms))\nexport function safeStringify(value: unknown, indent = 0): string {\n\ttry {\n\t\tconst seen = new WeakSet()\n\t\treturn JSON.stringify(\n\t\t\tvalue,\n\t\t\t(_key, val) => {\n\t\t\t\tif (typeof val === 'object' && val !== null) {\n\t\t\t\t\tif (seen.has(val)) return '[Circular]'\n\t\t\t\t\tseen.add(val)\n\t\t\t\t}\n\t\t\t\tif (typeof val === 'bigint') return val.toString() + 'n'\n\t\t\t\tif (val instanceof Error) {\n\t\t\t\t\treturn { name: val.name, message: val.message, stack: val.stack }\n\t\t\t\t}\n\t\t\t\treturn val\n\t\t\t},\n\t\t\tindent,\n\t\t)\n\t} catch {\n\t\treturn '[unserializable]'\n\t}\n}\nexport function extractFilenameFromContentDisposition(header: string | undefined): string | null {\n\tif (!header) return null\n\tconst encodedMatch = header.match(/filename\\*=UTF-8''([^;\\n\"]+)/i)\n\tif (encodedMatch?.[1]) {\n\t\ttry {\n\t\t\treturn decodeURIComponent(encodedMatch[1])\n\t\t} catch {}\n\t}\n\tconst quotedMatch = header.match(/filename\\s*=\\s*\"([^\"]+)\"/i)\n\tif (quotedMatch?.[1]) return quotedMatch[1]\n\tconst plainMatch = header.match(/filename\\s*=\\s*([^;,\\n\"]+)/i)\n\tif (plainMatch?.[1]) return plainMatch[1].trim()\n\treturn null\n}\nexport function calculateRetryDelay(\n\tattempt: number,\n\tbaseDelayMs: number,\n\tmaxDelayMs = 30000,\n): number {\n\tconst exponential = baseDelayMs * Math.pow(2, attempt - 1)\n\tconst jitter = Math.random() * 0.3 * exponential\n\treturn Math.min(exponential + jitter, maxDelayMs)\n}\nexport function isError(value: unknown): value is Error {\n\treturn (\n\t\tvalue instanceof Error ||\n\t\t(typeof value === 'object' && value !== null && 'message' in value)\n\t)\n}\n","import { chromium, Browser, BrowserContext, Page, Download, Response } from 'playwright'\nimport * as fs from 'fs/promises'\nimport path from 'path'\nimport os from 'os'\nimport { Logger } from '../utils/logger.js'\nimport { BrowserError, NetworkError } from '../errors/index.js'\nimport { DEFAULTS } from '../config/defaults.js'\nimport { SfilePageInteractions } from './page-interactions.js'\nimport { sleep, extractFilenameFromContentDisposition } from '../utils/helpers.js'\nexport interface BrowserManagerOptions {\n\theadless: boolean\n\tuserAgent: string\n\ttimeout: number\n\tdebug: boolean\n\tdownloadButtonTimeout?: number\n}\nexport class BrowserManager {\n\tprivate browser: Browser | null = null\n\tprivate context: BrowserContext | null = null\n\tprivate page: Page | null = null\n\tprivate interactions: SfilePageInteractions | null = null\n\tprivate debugDir: string | null = null\n\tprivate readonly stageHistory: Array<{ stage: string; ts: number }> = []\n\tconstructor(\n\t\tprivate logger: Logger,\n\t\tprivate opts: BrowserManagerOptions,\n\t) {}\n\tprivate trackStage(stage: string): void {\n\t\tthis.stageHistory.push({ stage, ts: Date.now() })\n\t}\n\tasync launch(): Promise<void> {\n\t\tconst stage = 'launch'\n\t\tthis.trackStage(stage)\n\t\ttry {\n\t\t\tthis.logger.info('Launching browser', { headless: this.opts.headless })\n\t\t\tthis.browser = await chromium.launch({\n\t\t\t\theadless: this.opts.headless,\n\t\t\t\targs: [\n\t\t\t\t\t'--no-sandbox',\n\t\t\t\t\t'--disable-setuid-sandbox',\n\t\t\t\t\t'--disable-dev-shm-usage',\n\t\t\t\t\t'--disable-accelerated-2d-canvas',\n\t\t\t\t\t'--no-first-run',\n\t\t\t\t\t'--no-zygote',\n\t\t\t\t],\n\t\t\t})\n\t\t\tthis.context = await this.browser.newContext({\n\t\t\t\tuserAgent: this.opts.userAgent,\n\t\t\t\tacceptDownloads: true,\n\t\t\t\tlocale: 'en-US',\n\t\t\t\ttimezoneId: 'UTC',\n\t\t\t\tviewport: { width: 1280, height: 720 },\n\t\t\t})\n\t\t\tawait this.context.addCookies([\n\t\t\t\t{\n\t\t\t\t\tname: 'safe_link_counter',\n\t\t\t\t\tvalue: '1',\n\t\t\t\t\tdomain: '.sfile.co',\n\t\t\t\t\tpath: '/',\n\t\t\t\t\texpires: Math.floor(Date.now() / 1000) + 3600,\n\t\t\t\t},\n\t\t\t])\n\t\t\tthis.page = await this.context.newPage()\n\t\t\tthis.interactions = new SfilePageInteractions(this.page, this.logger)\n\t\t\tif (this.opts.debug) {\n\t\t\t\tthis.setupDebugListeners()\n\t\t\t}\n\t\t\tthis.logger.info('Browser ready')\n\t\t} catch (err: any) {\n\t\t\tawait this.handleStageError(stage, err)\n\t\t\tthrow new BrowserError(`Failed to launch browser: ${err.message}`, {\n\t\t\t\tstage,\n\t\t\t\toriginalError: err.message,\n\t\t\t\tuserAgent: this.opts.userAgent,\n\t\t\t})\n\t\t}\n\t}\n\tprivate setupDebugListeners(): void {\n\t\tif (!this.page) return\n\t\tthis.page.on('console', (msg) => {\n\t\t\tconst type = msg.type()\n\t\t\tconst text = msg.text()\n\t\t\tif (type === 'error') {\n\t\t\t\tthis.logger.error(`[console] ${text}`, { location: msg.location() })\n\t\t\t} else if (type === 'warning') {\n\t\t\t\tthis.logger.warn(`[console] ${text}`)\n\t\t\t} else if (type === 'debug') {\n\t\t\t\tthis.logger.debug(`[console] ${text}`)\n\t\t\t}\n\t\t})\n\t\tthis.page.on('pageerror', (err) => {\n\t\t\tthis.logger.error('[pageerror]', undefined, err)\n\t\t})\n\t\tthis.page.on('requestfailed', (req) => {\n\t\t\tconst failure = req.failure()\n\t\t\tthis.logger.warn('[requestfailed]', {\n\t\t\t\turl: req.url(),\n\t\t\t\tmethod: req.method(),\n\t\t\t\terror: failure?.errorText,\n\t\t\t})\n\t\t})\n\t}\n\tasync goto(\n\t\turl: string,\n\t\twaitUntil: 'load' | 'networkidle' | 'commit' | 'domcontentloaded' = 'networkidle',\n\t): Promise<void> {\n\t\tconst stage = 'navigation'\n\t\tthis.trackStage(stage)\n\t\tif (!this.page) {\n\t\t\tthrow new BrowserError('Page not initialized', { stage })\n\t\t}\n\t\ttry {\n\t\t\tthis.logger.debug(`Navigating to ${url}`, { waitUntil, timeout: this.opts.timeout })\n\t\t\tawait this.page.goto(url, { waitUntil, timeout: this.opts.timeout })\n\t\t} catch (err: any) {\n\t\t\tawait this.handleStageError(stage, err)\n\t\t\tthrow new NetworkError(`Navigation failed: ${err.message}`, {\n\t\t\t\turl,\n\t\t\t\tstage,\n\t\t\t\twaitUntil,\n\t\t\t\ttimeout: this.opts.timeout,\n\t\t\t\toriginalError: err.message,\n\t\t\t})\n\t\t}\n\t}\n\tasync waitForDownloadButton(): Promise<void> {\n\t\tconst stage = 'waitForButton'\n\t\tthis.trackStage(stage)\n\t\tif (!this.interactions) {\n\t\t\tthrow new BrowserError('Interactions not ready', { stage })\n\t\t}\n\t\tconst timeout = this.opts.downloadButtonTimeout ?? DEFAULTS.downloadButtonTimeout\n\t\ttry {\n\t\t\tawait this.interactions.waitForDownloadButton(timeout)\n\t\t} catch (err: any) {\n\t\t\tawait this.handleStageError(stage, err)\n\t\t\tthrow new NetworkError(`Failed to wait for download button: ${err.message}`, {\n\t\t\t\tstage,\n\t\t\t\ttimeout,\n\t\t\t\toriginalError: err.message,\n\t\t\t})\n\t\t}\n\t}\n\tasync getIntermediateUrl(): Promise<string> {\n\t\tconst stage = 'extractUrl'\n\t\tthis.trackStage(stage)\n\t\tif (!this.interactions) {\n\t\t\tthrow new BrowserError('Interactions not ready', { stage })\n\t\t}\n\t\ttry {\n\t\t\tconst url = await this.interactions.extractIntermediateUrl()\n\t\t\tthis.logger.debug('Intermediate URL extracted', { url })\n\t\t\treturn url\n\t\t} catch (err: any) {\n\t\t\tawait this.handleStageError(stage, err)\n\t\t\tthrow new NetworkError(`Failed to extract intermediate URL: ${err.message}`, {\n\t\t\t\tstage,\n\t\t\t\toriginalError: err.message,\n\t\t\t})\n\t\t}\n\t}\n\tasync startDownloadAndWait(autoUrl: string): Promise<Download | null> {\n\t\tconst stage = 'downloadWait'\n\t\tthis.trackStage(stage)\n\t\tif (!this.page) {\n\t\t\tthrow new BrowserError('Page not initialized', { stage })\n\t\t}\n\t\tconst downloadPromise = this.page\n\t\t\t.waitForEvent('download', { timeout: this.opts.timeout })\n\t\t\t.catch((err) => {\n\t\t\t\tthis.logger.debug('Download event timeout', {\n\t\t\t\t\ttimeout: this.opts.timeout,\n\t\t\t\t\terror: err.message,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t})\n\t\tthis.logger.debug('Navigating to auto download URL', { url: autoUrl })\n\t\tawait this.page\n\t\t\t.goto(autoUrl, { waitUntil: 'commit', timeout: this.opts.timeout })\n\t\t\t.catch((err) => {\n\t\t\t\tthis.logger.warn('Navigation to auto URL failed, continuing anyway', {\n\t\t\t\t\terror: err.message,\n\t\t\t\t})\n\t\t\t})\n\t\tconst download = await downloadPromise\n\t\tif (download) {\n\t\t\tthis.logger.info('Download event captured')\n\t\t\treturn download\n\t\t}\n\t\tthis.logger.debug('No download event captured within timeout')\n\t\treturn null\n\t}\n\tasync fallbackCollectFileResponse(): Promise<{ buffer: Buffer; filename: string } | null> {\n\t\tconst stage = 'fallbackIntercept'\n\t\tthis.trackStage(stage)\n\t\tif (!this.page) {\n\t\t\tthrow new BrowserError('Page not initialized', { stage })\n\t\t}\n\t\tthis.logger.info('Falling back to response interception')\n\t\tconst responses: Response[] = []\n\t\tconst handler = (res: Response) => responses.push(res)\n\t\tthis.page.on('response', handler)\n\t\tawait sleep(DEFAULTS.fallbackWaitMs)\n\t\tthis.page.off('response', handler)\n\t\tconst fileResponse = [...responses].reverse().find((r) => {\n\t\t\tconst headers = r.headers()\n\t\t\tconst disposition = headers['content-disposition']\n\t\t\tconst contentType = headers['content-type']\n\t\t\tconst url = r.url()\n\t\t\treturn (\n\t\t\t\t(disposition && disposition.includes('attachment')) ||\n\t\t\t\turl.includes('/downloadfile/') ||\n\t\t\t\t(contentType &&\n\t\t\t\t\t!contentType.startsWith('text/html') &&\n\t\t\t\t\t!contentType.startsWith('application/json'))\n\t\t\t)\n\t\t})\n\t\tif (!fileResponse) {\n\t\t\tthis.logger.debug('No suitable file response found in fallback', {\n\t\t\t\tresponseCount: responses.length,\n\t\t\t\tsampleUrls: responses.slice(0, 3).map((r) => r.url()),\n\t\t\t})\n\t\t\treturn null\n\t\t}\n\t\ttry {\n\t\t\tconst buffer = await fileResponse.body()\n\t\t\tlet filename = extractFilenameFromContentDisposition(\n\t\t\t\tfileResponse.headers()['content-disposition'],\n\t\t\t)\n\t\t\tif (!filename) {\n\t\t\t\tconst urlParts = fileResponse.url().split('/')\n\t\t\t\tfilename = urlParts[urlParts.length - 1]?.split('?')[0] || 'file.bin'\n\t\t\t}\n\t\t\tfilename = filename.replace(/[<>:\"/\\\\|?*]/g, '_')\n\t\t\tthis.logger.info('Fallback response captured', {\n\t\t\t\tfilename,\n\t\t\t\tsize: buffer.length,\n\t\t\t\tcontentType: fileResponse.headers()['content-type'],\n\t\t\t})\n\t\t\treturn { buffer, filename }\n\t\t} catch (err: any) {\n\t\t\tthis.logger.error('Failed to read fallback response body', { error: err.message })\n\t\t\treturn null\n\t\t}\n\t}\n\tasync saveDebugArtifacts(errorMessage: string): Promise<string | null> {\n\t\tif (!this.opts.debug || !this.page) return null\n\t\ttry {\n\t\t\tthis.debugDir = path.join(\n\t\t\t\tos.tmpdir(),\n\t\t\t\t`sfile_debug_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,\n\t\t\t)\n\t\t\tawait fs.mkdir(this.debugDir, { recursive: true })\n\t\t\tconst tasks: Promise<void>[] = [\n\t\t\t\tthis.page\n\t\t\t\t\t.screenshot({\n\t\t\t\t\t\tpath: path.join(this.debugDir, 'error.png'),\n\t\t\t\t\t\tfullPage: true,\n\t\t\t\t\t})\n\t\t\t\t\t.then(() => {}),\n\t\t\t\tfs.writeFile(path.join(this.debugDir, 'error.html'), await this.page.content()),\n\t\t\t\tfs.writeFile(path.join(this.debugDir, 'error.txt'), errorMessage),\n\t\t\t\tfs.writeFile(\n\t\t\t\t\tpath.join(this.debugDir, 'stages.json'),\n\t\t\t\t\tJSON.stringify(this.stageHistory, null, 2),\n\t\t\t\t),\n\t\t\t]\n\t\t\tawait Promise.all(tasks)\n\t\t\tthis.logger.info('Debug artifacts saved', { debugDir: this.debugDir })\n\t\t\treturn this.debugDir\n\t\t} catch (e: any) {\n\t\t\tthis.logger.error('Failed to save debug artifacts', { error: e.message })\n\t\t\treturn null\n\t\t}\n\t}\n\tprivate async handleStageError(stage: string, error: any): Promise<void> {\n\t\tif (this.opts.debug) {\n\t\t\tawait this.saveDebugArtifacts(\n\t\t\t\t`Error at stage \"${stage}\": ${error?.message || 'Unknown error'}`,\n\t\t\t)\n\t\t}\n\t}\n\tasync close(): Promise<void> {\n\t\tconst closePromises = [\n\t\t\tthis.page?.close().catch(() => {}),\n\t\t\tthis.context?.close().catch(() => {}),\n\t\t\tthis.browser?.close().catch(() => {}),\n\t\t].filter(Boolean) as Promise<void>[]\n\t\tawait Promise.all(closePromises)\n\t\tthis.logger.debug('Browser closed', { stages: this.stageHistory.length })\n\t}\n\tasync getPage(): Promise<Page | null> {\n\t\treturn this.page\n\t}\n\tgetDebugDir(): string | null {\n\t\treturn this.debugDir\n\t}\n\tgetStageHistory(): ReadonlyArray<{ stage: string; ts: number }> {\n\t\treturn [...this.stageHistory]\n\t}\n}\n","import { createWriteStream, type WriteStream } from 'fs'\nimport { safeStringify } from './helpers.js'\ntype LogLevel = 'debug' | 'info' | 'warn' | 'error'\nexport interface LoggerOptions {\n\tdebugMode?: boolean\n\tcorrelationId?: string\n\tlogFile?: string\n\tprefix?: string\n}\nexport class Logger {\n\tprivate minLevel: LogLevel\n\tprivate correlationId: string | undefined\n\tprivate fileStream: WriteStream | null = null\n\tprivate prefix: string\n\tconstructor(options: LoggerOptions = {}) {\n\t\tthis.minLevel = options.debugMode ? 'debug' : 'info'\n\t\tthis.correlationId = options.correlationId\n\t\tthis.prefix = options.prefix || ''\n\t\tif (options.logFile) {\n\t\t\tthis.fileStream = createWriteStream(options.logFile, { flags: 'a' })\n\t\t}\n\t}\n\tsetCorrelationId(id: string): void {\n\t\tthis.correlationId = id\n\t}\n\tsetDebug(enabled: boolean): void {\n\t\tthis.minLevel = enabled ? 'debug' : 'info'\n\t}\n\tprivate levelPriority(level: LogLevel): number {\n\t\treturn { debug: 0, info: 1, warn: 2, error: 3 }[level]\n\t}\n\tprivate shouldLog(level: LogLevel): boolean {\n\t\treturn this.levelPriority(level) >= this.levelPriority(this.minLevel)\n\t}\n\tprivate format(level: LogLevel, message: string, context?: unknown): string {\n\t\tconst ts = new Date().toISOString()\n\t\tconst corr = this.correlationId ? ` [${this.correlationId}]` : ''\n\t\tconst prefix = this.prefix ? ` [${this.prefix}]` : ''\n\t\tconst ctx = context ? ` | ${safeStringify(context)}` : ''\n\t\treturn `[${ts}]${corr}${prefix} ${level.toUpperCase()}: ${message}${ctx}`\n\t}\n\tprivate write(level: LogLevel, message: string, context?: unknown): void {\n\t\tif (!this.shouldLog(level)) return\n\t\tconst formatted = this.format(level, message, context)\n\t\tconst consoleMethod = level === 'error' ? 'error' : level === 'warn' ? 'warn' : 'log'\n\t\tconsole[consoleMethod](formatted)\n\t\tif (this.fileStream?.writable) {\n\t\t\tthis.fileStream.write(formatted + '\\n')\n\t\t}\n\t}\n\tdebug(msg: string, ctx?: unknown): void {\n\t\tthis.write('debug', msg, ctx)\n\t}\n\tinfo(msg: string, ctx?: unknown): void {\n\t\tthis.write('info', msg, ctx)\n\t}\n\twarn(msg: string, ctx?: unknown): void {\n\t\tthis.write('warn', msg, ctx)\n\t}\n\terror(msg: string, ctx?: unknown, err?: Error): void {\n\t\tlet errorCtx: unknown\n\t\tif (err) {\n\t\t\tconst baseObj =\n\t\t\t\tctx && typeof ctx === 'object' && ctx !== null\n\t\t\t\t\t? { ...(ctx as Record<string, unknown>) }\n\t\t\t\t\t: {}\n\t\t\terrorCtx = {\n\t\t\t\t...baseObj,\n\t\t\t\terror: { name: err.name, message: err.message },\n\t\t\t}\n\t\t} else {\n\t\t\terrorCtx = ctx\n\t\t}\n\t\tthis.write('error', msg, errorCtx)\n\t}\n\tchild(prefix: string): Logger {\n\t\tconst childOptions: LoggerOptions = {\n\t\t\tdebugMode: this.minLevel === 'debug',\n\t\t\t...(this.correlationId !== undefined && { correlationId: this.correlationId }),\n\t\t\tprefix: this.prefix ? `${this.prefix}:${prefix}` : prefix,\n\t\t}\n\t\tconst child = new Logger(childOptions)\n\t\tif (this.fileStream) {\n\t\t\t;(child as any).fileStream = this.fileStream\n\t\t}\n\t\treturn child\n\t}\n\tasync close(): Promise<void> {\n\t\tif (this.fileStream && !this.fileStream.closed) {\n\t\t\treturn new Promise((resolve) => this.fileStream?.end(resolve))\n\t\t}\n\t}\n}\n","import { DEFAULTS } from './defaults.js'\nexport interface DownloadOptions {\n\theadless?: boolean\n\tuserAgent?: string\n\ttimeout?: number\n\tdownloadButtonTimeout?: number\n\tretries?: number\n\tretryDelay?: number\n\tonProgress?: (\n\t\tpercent: number,\n\t\ttotal: 100,\n\t\tmeta: { stage: string; message: string; attempt?: number },\n\t) => void\n\tcorrelationId?: string\n\tdebug?: boolean\n\tsaveDebugArtifacts?: boolean\n\tlogFile?: string\n\t_internal?: {\n\t\tstage?: string\n\t}\n}\nexport interface DownloadResult {\n\tfilePath: string\n\tsize: number\n\tmethod: 'direct' | 'fallback'\n\tcorrelationId?: string\n\tdurationMs?: number\n\tattempts?: number\n}\ntype NormalizedOptions = Required<\n\tOmit<DownloadOptions, 'onProgress' | 'correlationId' | '_internal' | 'logFile'>\n> & {\n\tonProgress?: DownloadOptions['onProgress']\n\tcorrelationId?: string\n\t_internal?: DownloadOptions['_internal']\n\tlogFile?: string\n}\nexport function normalizeOptions(opts?: DownloadOptions): NormalizedOptions {\n\tconst base = {\n\t\theadless: opts?.headless ?? DEFAULTS.headless,\n\t\tuserAgent: opts?.userAgent ?? DEFAULTS.userAgent,\n\t\ttimeout: opts?.timeout ?? DEFAULTS.timeout,\n\t\tdownloadButtonTimeout: opts?.downloadButtonTimeout ?? DEFAULTS.downloadButtonTimeout,\n\t\tretries: opts?.retries ?? DEFAULTS.retries,\n\t\tretryDelay: opts?.retryDelay ?? DEFAULTS.retryDelay,\n\t\tdebug: opts?.debug ?? false,\n\t\tsaveDebugArtifacts: opts?.saveDebugArtifacts ?? DEFAULTS.saveDebugArtifacts,\n\t}\n\tconst optional = {\n\t\t...(opts?.onProgress !== undefined && { onProgress: opts.onProgress }),\n\t\t...(opts?.correlationId !== undefined && { correlationId: opts.correlationId }),\n\t\t...(opts?._internal !== undefined && { _internal: opts._internal }),\n\t\t...(opts?.logFile !== undefined && { logFile: opts.logFile }),\n\t}\n\treturn { ...base, ...optional } as NormalizedOptions\n}\n","import { ValidationError } from '../errors/index.js'\nimport { sanitizeFilename } from '../utils/helpers.js'\nimport { DEFAULTS } from '../config/defaults.js'\nexport class InputValidator {\n\tstatic validateUrl(\n\t\turl: unknown,\n\t\tallowedDomains: readonly string[] = ['sfile.co', 'sfile.mobi'],\n\t): asserts url is string {\n\t\tif (!url || typeof url !== 'string') {\n\t\t\tthrow new ValidationError('URL must be a non-empty string', {\n\t\t\t\treceived: typeof url,\n\t\t\t\turl,\n\t\t\t})\n\t\t}\n\t\tconst hasAllowedDomain = allowedDomains.some((domain) => url.includes(domain))\n\t\tif (!hasAllowedDomain) {\n\t\t\tthrow new ValidationError(`URL must contain one of: ${allowedDomains.join(', ')}`, {\n\t\t\t\turl,\n\t\t\t\tallowedDomains,\n\t\t\t})\n\t\t}\n\t\ttry {\n\t\t\tconst parsed = new URL(url)\n\t\t\tif (!['http:', 'https:'].includes(parsed.protocol)) {\n\t\t\t\tthrow new ValidationError('URL must use http or https protocol', {\n\t\t\t\t\turl,\n\t\t\t\t\tprotocol: parsed.protocol,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (parseErr) {\n\t\t\tthrow new ValidationError('Invalid URL format', {\n\t\t\t\turl,\n\t\t\t\tparseError: parseErr instanceof Error ? parseErr.message : String(parseErr),\n\t\t\t})\n\t\t}\n\t}\n\tstatic validateSaveDir(dir: unknown): asserts dir is string {\n\t\tif (!dir || typeof dir !== 'string') {\n\t\t\tthrow new ValidationError('Save directory must be a non-empty string', {\n\t\t\t\treceived: typeof dir,\n\t\t\t\tdir,\n\t\t\t})\n\t\t}\n\t}\n\tstatic sanitizeFilename(name: string): string {\n\t\tconst replacement = DEFAULTS.sanitizeReplacement\n\t\tconst maxLength = DEFAULTS.maxFilenameLength\n\t\tconst sanitized = sanitizeFilename(name, replacement)\n\t\tif (!sanitized || sanitized.length === 0) {\n\t\t\tconst ext = name.includes('.') ? name.split('.').pop() : 'bin'\n\t\t\treturn `downloaded_file${ext ? '.' + ext : ''}`.slice(0, maxLength)\n\t\t}\n\t\treturn sanitized.slice(0, maxLength)\n\t}\n\tstatic validateOptions(options: unknown): void {\n\t\tif (options && typeof options !== 'object') {\n\t\t\tthrow new ValidationError('Options must be an object or undefined', {\n\t\t\t\treceived: typeof options,\n\t\t\t})\n\t\t}\n\t\tconst opts = options as Record<string, unknown>\n\t\tconst numericFields = ['timeout', 'retries', 'retryDelay', 'downloadButtonTimeout'] as const\n\t\tfor (const field of numericFields) {\n\t\t\tif (field in opts && typeof opts[field] !== 'number') {\n\t\t\t\tthrow new ValidationError(`Option '${field}' must be a number`, {\n\t\t\t\t\tfield,\n\t\t\t\t\treceived: typeof opts[field],\n\t\t\t\t\tvalue: opts[field],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tconst booleanFields = ['headless', 'debug', 'saveDebugArtifacts'] as const\n\t\tfor (const field of booleanFields) {\n\t\t\tif (field in opts && typeof opts[field] !== 'boolean') {\n\t\t\t\tthrow new ValidationError(`Option '${field}' must be a boolean`, {\n\t\t\t\t\tfield,\n\t\t\t\t\treceived: typeof opts[field],\n\t\t\t\t\tvalue: opts[field],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}\n","import * as path from 'path'\nimport { promises as fs } from 'fs'\nimport { randomUUID } from 'crypto'\nimport { BrowserManager } from '../browser/browser-manager.js'\nimport { Logger } from '../utils/logger.js'\nimport { NetworkError, AppError } from '../errors/index.js'\nimport { DownloadOptions, DownloadResult, normalizeOptions } from '../config/schema.js'\nimport { DEFAULTS } from '../config/defaults.js'\nimport { InputValidator } from './validator.js'\nimport { sleep, calculateRetryDelay } from '../utils/helpers.js'\nfunction stripUndefined<T extends Record<string, unknown>>(obj: T): T {\n\treturn Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as T\n}\nfunction safeProgress(\n\tonProgress: unknown,\n\tpercent: number,\n\ttotal: number,\n\tmeta: Record<string, unknown>,\n): void {\n\tif (typeof onProgress === 'function') {\n\t\ttry {\n\t\t\t;(onProgress as any)(percent, total, meta)\n\t\t} catch (err) {\n\t\t\tconsole.warn('Progress callback error:', err)\n\t\t}\n\t}\n}\nasync function executeDownload(\n\turl: string,\n\tsaveDir: string,\n\topts: ReturnType<typeof normalizeOptions>,\n\tlogger: Logger,\n): Promise<DownloadResult> {\n\tconst startTime = Date.now()\n\tconst browserMgr = new BrowserManager(logger.child('BrowserManager'), {\n\t\theadless: opts.headless,\n\t\tuserAgent: opts.userAgent,\n\t\ttimeout: opts.timeout,\n\t\tdebug: opts.debug,\n\t\tdownloadButtonTimeout: opts.downloadButtonTimeout,\n\t})\n\tlet finalPath: string\n\tlet fileSize: number\n\tlet method: 'direct' | 'fallback'\n\ttry {\n\t\tlogger.info('Starting download workflow', { url })\n\t\tsafeProgress(opts.onProgress, 10, 100, {\n\t\t\tstage: 'launch',\n\t\t\tmessage: 'Launching browser',\n\t\t\tattempt: 1,\n\t\t})\n\t\tawait browserMgr.launch()\n\t\tawait browserMgr.goto(url, 'networkidle')\n\t\tsafeProgress(opts.onProgress, 30, 100, { stage: 'navigation', message: 'Page loaded' })\n\t\tawait browserMgr.waitForDownloadButton()\n\t\tsafeProgress(opts.onProgress, 50, 100, {\n\t\t\tstage: 'button',\n\t\t\tmessage: 'Download button ready',\n\t\t})\n\t\tconst intermediateUrl = await browserMgr.getIntermediateUrl()\n\t\tconst autoUrl = intermediateUrl.includes('?')\n\t\t\t? `${intermediateUrl}&auto=1`\n\t\t\t: `${intermediateUrl}?auto=1`\n\t\tlogger.debug('Triggering download', { autoUrl })\n\t\tsafeProgress(opts.onProgress, 70, 100, { stage: 'trigger', message: 'Download triggered' })\n\t\tlet download = await browserMgr.startDownloadAndWait(autoUrl)\n\t\tif (download) {\n\t\t\tconst suggested = download.suggestedFilename() || 'file.bin'\n\t\t\tconst filename = InputValidator.sanitizeFilename(suggested)\n\t\t\tfinalPath = path.join(saveDir, filename)\n\t\t\tawait download.saveAs(finalPath)\n\t\t\tconst stat = await fs.stat(finalPath)\n\t\t\tfileSize = stat.size\n\t\t\tmethod = 'direct'\n\t\t\tlogger.info('Saved via direct download', { path: finalPath, size: fileSize })\n\t\t} else {\n\t\t\tlogger.warn('Direct download not captured, trying fallback')\n\t\t\tconst fallback = await browserMgr.fallbackCollectFileResponse()\n\t\t\tif (!fallback) {\n\t\t\t\tthrow new NetworkError('No download event and no file response found', {\n\t\t\t\t\turl,\n\t\t\t\t\tintermediateUrl,\n\t\t\t\t\tautoUrl,\n\t\t\t\t\tstage: 'fallbackFailed',\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst { buffer, filename: rawName } = fallback\n\t\t\tconst filename = InputValidator.sanitizeFilename(rawName)\n\t\t\tfinalPath = path.join(saveDir, filename)\n\t\t\tawait fs.writeFile(finalPath, buffer)\n\t\t\tfileSize = buffer.length\n\t\t\tmethod = 'fallback'\n\t\t\tlogger.info('Saved via fallback', { path: finalPath, size: fileSize })\n\t\t}\n\t\tsafeProgress(opts.onProgress, 100, 100, { stage: 'complete', message: 'Download finished' })\n\t\tconst result: DownloadResult = {\n\t\t\tfilePath: finalPath,\n\t\t\tsize: fileSize,\n\t\t\tmethod,\n\t\t\tdurationMs: Date.now() - startTime,\n\t\t\tattempts: 1,\n\t\t}\n\t\tif (opts.correlationId !== undefined) {\n\t\t\tresult.correlationId = opts.correlationId\n\t\t}\n\t\treturn result\n\t} catch (err: unknown) {\n\t\tconst error = err instanceof Error ? err : new Error(String(err))\n\t\tconst appError =\n\t\t\terror instanceof AppError\n\t\t\t\t? error\n\t\t\t\t: new NetworkError(error.message, {\n\t\t\t\t\t\turl,\n\t\t\t\t\t\tsaveDir,\n\t\t\t\t\t\tcorrelationId: opts.correlationId,\n\t\t\t\t\t\toriginalError: error.message,\n\t\t\t\t\t\terrorName: error.name,\n\t\t\t\t\t})\n\t\tif (opts.saveDebugArtifacts) {\n\t\t\tconst debugPath = await browserMgr.saveDebugArtifacts(appError.message)\n\t\t\tif (debugPath) {\n\t\t\t\t;(appError as any).debugPath = debugPath\n\t\t\t\tif (appError.context && typeof appError.context === 'object') {\n\t\t\t\t\t;(appError.context as any).debugPath = debugPath\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthrow appError\n\t} finally {\n\t\tawait browserMgr\n\t\t\t.close()\n\t\t\t.catch((e) => logger.error('Failed to close browser', { error: e.message }))\n\t\tawait logger.close().catch((e) => console.error('Failed to close logger', e))\n\t}\n}\nexport async function downloadSfile(\n\turl: string,\n\tsaveDir: string,\n\toptions?: DownloadOptions,\n): Promise<DownloadResult> {\n\tconst opts = normalizeOptions(options)\n\tconst correlationId = opts.correlationId || randomUUID()\n\ttype LoggerConstructorParams = ConstructorParameters<typeof Logger>\n\ttype LoggerOptionsType = LoggerConstructorParams[0]\n\tconst loggerOptions: LoggerOptionsType = {\n\t\tdebugMode: opts.debug,\n\t\tcorrelationId,\n\t\tprefix: 'downloadSfile',\n\t}\n\tif (opts.logFile !== undefined) {\n\t\tloggerOptions.logFile = opts.logFile\n\t}\n\tconst logger = new Logger(loggerOptions)\n\tInputValidator.validateUrl(url)\n\tInputValidator.validateSaveDir(saveDir)\n\tInputValidator.validateOptions(options)\n\tawait fs.mkdir(saveDir, { recursive: true })\n\tlet lastError: Error | undefined\n\tlet attempt = 0\n\twhile (attempt < opts.retries) {\n\t\tattempt++\n\t\ttry {\n\t\t\tlogger.info(`Download attempt ${attempt}/${opts.retries}`, { url })\n\t\t\tconst result = await executeDownload(url, saveDir, opts, logger)\n\t\t\tlogger.info(`Download succeeded`, {\n\t\t\t\tduration: result.durationMs,\n\t\t\t\tattempts: attempt,\n\t\t\t\tmethod: result.method,\n\t\t\t})\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\tattempts: attempt,\n\t\t\t\tcorrelationId,\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tlastError = err instanceof Error ? err : new Error(String(err))\n\t\t\tconst isRetryable = lastError instanceof AppError && lastError.retryable\n\t\t\tconst isLastAttempt = attempt >= opts.retries\n\t\t\tif (!isRetryable || isLastAttempt) {\n\t\t\t\tlogger.error(`Download failed permanently`, {\n\t\t\t\t\terror: lastError.message,\n\t\t\t\t\tattempt,\n\t\t\t\t\tretryable: isRetryable,\n\t\t\t\t\tlastAttempt: isLastAttempt,\n\t\t\t\t})\n\t\t\t\tthrow lastError\n\t\t\t}\n\t\t\tconst delay = calculateRetryDelay(attempt, opts.retryDelay, DEFAULTS.maxRetryDelay)\n\t\t\tlogger.warn(`Retrying download`, {\n\t\t\t\tattempt,\n\t\t\t\tmaxAttempts: opts.retries,\n\t\t\t\tdelayMs: Math.round(delay),\n\t\t\t\terror: lastError.message,\n\t\t\t})\n\t\t\tsafeProgress(opts.onProgress, 0, 100, {\n\t\t\t\tstage: 'retry',\n\t\t\t\tmessage: `Retry ${attempt}/${opts.retries}`,\n\t\t\t\tattempt,\n\t\t\t})\n\t\t\tawait sleep(delay)\n\t\t}\n\t}\n\tthrow lastError || new Error('Download failed after all retries')\n}\nexport async function downloadSfileSafe(\n\turl: string,\n\tsaveDir: string,\n\toptions?: DownloadOptions,\n): Promise<import('../utils/result.js').Result<DownloadResult, Error>> {\n\ttry {\n\t\tconst result = await downloadSfile(url, saveDir, options)\n\t\treturn { success: true, value: result }\n\t} catch (error) {\n\t\treturn { success: false, error: error as Error }\n\t}\n}\nexport function createDownloader(defaultOptions?: DownloadOptions) {\n\tconst defaults = normalizeOptions(defaultOptions)\n\treturn {\n\t\tasync download(\n\t\t\turl: string,\n\t\t\tsaveDir: string,\n\t\t\tcallOptions?: DownloadOptions,\n\t\t): Promise<DownloadResult> {\n\t\t\tconst merged = stripUndefined({ ...defaults, ...callOptions })\n\t\t\treturn downloadSfile(url, saveDir, merged as DownloadOptions)\n\t\t},\n\t\tasync downloadSafe(\n\t\t\turl: string,\n\t\t\tsaveDir: string,\n\t\t\tcallOptions?: DownloadOptions,\n\t\t): Promise<import('../utils/result.js').Result<DownloadResult, Error>> {\n\t\t\tconst merged = stripUndefined({ ...defaults, ...callOptions })\n\t\t\treturn downloadSfileSafe(url, saveDir, merged as DownloadOptions)\n\t\t},\n\t\twithOptions(newDefaults: Partial<DownloadOptions>) {\n\t\t\tconst merged = stripUndefined({ ...defaults, ...newDefaults })\n\t\t\treturn createDownloader(merged as DownloadOptions)\n\t\t},\n\t}\n}\n","export type Result<T, E = Error> = { success: true; value: T } | { success: false; error: E }\nexport function ok<T, E = never>(value: T): Result<T, E> {\n\treturn { success: true, value }\n}\nexport function err<E, T = never>(error: E): Result<T, E> {\n\treturn { success: false, error }\n}\nexport function isSuccess<T, E>(result: Result<T, E>): result is { success: true; value: T } {\n\treturn result.success === true\n}\nexport function isFailure<T, E>(result: Result<T, E>): result is { success: false; error: E } {\n\treturn result.success === false\n}\nexport function map<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E> {\n\tif (result.success) {\n\t\treturn { success: true, value: fn(result.value) }\n\t}\n\treturn result\n}\nexport function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F> {\n\tif (!result.success) {\n\t\treturn { success: false, error: fn(result.error) }\n\t}\n\treturn result\n}\nexport function getOrThrow<T, E>(result: Result<T, E>): T {\n\tif (result.success) return result.value\n\tthrow result.error\n}\n"],"names":["path","fs"],"mappings":";;;;;;;;AAAM,MAAgB,QAAS,SAAQ,KAAK,CAAA;AAC3B,IAAA,SAAS;AACT,IAAA,OAAO;AACP,IAAA,IAAI;AACJ,IAAA,SAAS;AACzB,IAAA,WAAA,CACC,OAAe,EACf,IAAY,EACZ,SAAA,GAAqB,KAAK,EAC1B,OAAiC,EAAA;QAEjC,KAAK,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI;AACjC,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS;QAC1B,IAA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,GAAG,WAAW,EAAE,CAAC;YAC9D,OAAO,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAyB,CAAC;QAClE,CAAC;AACD,QAAA,WAAW,CAAC,WAAqC,EAAA;AAChD,YAAA,MAAM,MAAM,GAAG,cAAc,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC;AAC9D,YAAA,OAAO,gBAAgB,CAAC,MAAyB,CAAC;QACnD,CAAC;KACD;AACF;;ACzOM,SAAU,SAAS,CAAO,MAAoB,EAAA;AACnD,IAAA,OAAO,MAAM,CAAC,OAAO,KAAK,IAAI;AAC/B;AACM,SAAU,SAAS,CAAO,MAAoB,EAAA;AACnD,IAAA,OAAO,MAAM,CAAC,OAAO,KAAK,KAAK;AAChC;AAOM,SAAU,QAAQ,CAAU,MAAoB,EAAE,EAAmB,EAAA;AAC1E,IAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;AACpB,QAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;IACnD;AACA,IAAA,OAAO,MAAM;AACd;;;;"}
|
package/changelog
CHANGED
|
@@ -1,3 +1,203 @@
|
|
|
1
|
+
commit bee596315d96e819de09fc3c41be8dbf48a0cff6
|
|
2
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
3
|
+
Date: Thu Apr 2 15:43:57 2026 +0700
|
|
4
|
+
|
|
5
|
+
update to v 2.2.0
|
|
6
|
+
|
|
7
|
+
commit 1815dceedf75d9bcf6792d434e29c13f1df3febb
|
|
8
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
9
|
+
Date: Thu Apr 2 15:43:35 2026 +0700
|
|
10
|
+
|
|
11
|
+
release v2.2.0
|
|
12
|
+
|
|
13
|
+
commit d6c9f4ba721946e3ad1fbf03e62c303b2b0db4e2
|
|
14
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
15
|
+
Date: Thu Apr 2 15:42:30 2026 +0700
|
|
16
|
+
|
|
17
|
+
chore: add homepage adn remake email addres
|
|
18
|
+
|
|
19
|
+
commit 4d496d12961ac124dc925023edd09f3b2ed4ca5d
|
|
20
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
21
|
+
Date: Thu Apr 2 14:41:42 2026 +0700
|
|
22
|
+
|
|
23
|
+
docs: add license documentation
|
|
24
|
+
|
|
25
|
+
commit 1ef8bc47f743ae5d9635f8a9a523339270f059b3
|
|
26
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
27
|
+
Date: Thu Apr 2 14:38:30 2026 +0700
|
|
28
|
+
|
|
29
|
+
chore(deps): install docsify-cli
|
|
30
|
+
|
|
31
|
+
commit 3957dff22a80224a94e773c483b5c9e1ef1b862d
|
|
32
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
33
|
+
Date: Thu Apr 2 14:37:47 2026 +0700
|
|
34
|
+
|
|
35
|
+
docs: add documentation
|
|
36
|
+
|
|
37
|
+
commit ac756423e300f61657cd12684b65b1193598de39
|
|
38
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
39
|
+
Date: Thu Apr 2 14:29:09 2026 +0700
|
|
40
|
+
|
|
41
|
+
chore(ci): remove --forzed flags
|
|
42
|
+
|
|
43
|
+
commit ea96232f1d174bf637ca02b3ba5e15f6cd1e8379
|
|
44
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
45
|
+
Date: Thu Apr 2 14:16:02 2026 +0700
|
|
46
|
+
|
|
47
|
+
chore(ci): remove --forzed flags
|
|
48
|
+
|
|
49
|
+
commit b5f26e7d68db524dde16e415f389513a5aa1d625
|
|
50
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
51
|
+
Date: Thu Apr 2 14:14:00 2026 +0700
|
|
52
|
+
|
|
53
|
+
chore: make all deps to latest version
|
|
54
|
+
|
|
55
|
+
commit aec077df776784f2454d4f02137a0e4da2b47c3f
|
|
56
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
57
|
+
Date: Thu Apr 2 14:13:43 2026 +0700
|
|
58
|
+
|
|
59
|
+
chore: make all deps to latest version
|
|
60
|
+
|
|
61
|
+
commit 3d97ed023174f7b516911f08ff13b8591cb383a4
|
|
62
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
63
|
+
Date: Thu Apr 2 14:09:48 2026 +0700
|
|
64
|
+
|
|
65
|
+
refactor(scripts): remove format-build.js — no longer needed
|
|
66
|
+
|
|
67
|
+
commit a58bb5ac7fb2264404366473ad7fd29cb004d82d
|
|
68
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
69
|
+
Date: Thu Apr 2 14:09:48 2026 +0700
|
|
70
|
+
|
|
71
|
+
refactor(build): remove rollup.config.mjs — build system simplified
|
|
72
|
+
|
|
73
|
+
commit 6d382fcdba8c4d7cf66603227fc5c16de012100a
|
|
74
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
75
|
+
Date: Thu Apr 2 14:09:47 2026 +0700
|
|
76
|
+
|
|
77
|
+
chore(lock): sync bun.lock with new dev dependency
|
|
78
|
+
|
|
79
|
+
commit 3600641dfaa04be4b72c4a5030a0518df7f77e5b
|
|
80
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
81
|
+
Date: Thu Apr 2 14:09:47 2026 +0700
|
|
82
|
+
|
|
83
|
+
chore(deps): add @types/rollup-plugin-peer-deps-external for type safety
|
|
84
|
+
|
|
85
|
+
commit 2d7e364aad740865ebfaf1b9e93527d2a239b7d9
|
|
86
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
87
|
+
Date: Thu Apr 2 11:53:26 2026 +0700
|
|
88
|
+
|
|
89
|
+
docs: edit changelog
|
|
90
|
+
|
|
91
|
+
commit c2d0e21d0e8bbae449db5ba6e6af0b6f572b3374
|
|
92
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
93
|
+
Date: Thu Apr 2 11:52:54 2026 +0700
|
|
94
|
+
|
|
95
|
+
chore: make all deps to latest version
|
|
96
|
+
|
|
97
|
+
commit c383258c2f9f74541c8d5a254d1fe4f7bf45f79e
|
|
98
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
99
|
+
Date: Thu Apr 2 11:45:20 2026 +0700
|
|
100
|
+
|
|
101
|
+
docs: edit readme.md
|
|
102
|
+
|
|
103
|
+
commit 70c7736412b06fb7d4660d2f0b8d6769efa6ae88
|
|
104
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
105
|
+
Date: Thu Apr 2 11:34:23 2026 +0700
|
|
106
|
+
|
|
107
|
+
docs: update changelog
|
|
108
|
+
|
|
109
|
+
commit 549aec09f8297318fcf52d69bc8262d78d769e0d
|
|
110
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
111
|
+
Date: Thu Apr 2 11:31:54 2026 +0700
|
|
112
|
+
|
|
113
|
+
chore(release): bump version to 2.1.1 for new download implementation
|
|
114
|
+
|
|
115
|
+
commit 54147f326795e40dd6e8e6f08e70fb7323ab2f25
|
|
116
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
117
|
+
Date: Thu Apr 2 11:31:54 2026 +0700
|
|
118
|
+
|
|
119
|
+
refactor(lib): simplify entry point to re-export core modules only
|
|
120
|
+
|
|
121
|
+
commit c82f51154fa17e8533b32c85c218644f46d2067a
|
|
122
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
123
|
+
Date: Thu Apr 2 11:31:50 2026 +0700
|
|
124
|
+
|
|
125
|
+
feat(core): implement downloadSfile function with direct/fallback download strategies
|
|
126
|
+
|
|
127
|
+
commit 84a9e5db96eee8cd195a46b934f792d8c94461c0
|
|
128
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
129
|
+
Date: Thu Apr 2 11:31:45 2026 +0700
|
|
130
|
+
|
|
131
|
+
feat(browser): implement BrowserManager for Playwright lifecycle and fallback handling
|
|
132
|
+
|
|
133
|
+
commit 8fb98f7b6da4717e27ddf019f1962fe25734cc45
|
|
134
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
135
|
+
Date: Thu Apr 2 11:31:44 2026 +0700
|
|
136
|
+
|
|
137
|
+
feat(browser): implement SfilePageInteractions for button wait and URL extraction
|
|
138
|
+
|
|
139
|
+
commit 0e5fa3e6fa007baaf2baa60ce6be475792ae7376
|
|
140
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
141
|
+
Date: Thu Apr 2 11:31:40 2026 +0700
|
|
142
|
+
|
|
143
|
+
feat(config): define DownloadOptions, DownloadResult types and normalizeOptions
|
|
144
|
+
|
|
145
|
+
commit 0271fcd44dc7d6ad5889e94f67af50f21afe23f6
|
|
146
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
147
|
+
Date: Thu Apr 2 11:31:39 2026 +0700
|
|
148
|
+
|
|
149
|
+
feat(config): add DEFAULTS constants for browser and timeout settings
|
|
150
|
+
|
|
151
|
+
commit 5c2b9514892096756f817d9c7302b80a4c0bdbdc
|
|
152
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
153
|
+
Date: Thu Apr 2 11:31:34 2026 +0700
|
|
154
|
+
|
|
155
|
+
feat(errors): export all error classes from index
|
|
156
|
+
|
|
157
|
+
commit 39e37b2392132c6e2f50544f363b6fef18a3693f
|
|
158
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
159
|
+
Date: Thu Apr 2 11:31:34 2026 +0700
|
|
160
|
+
|
|
161
|
+
feat(errors): implement ValidationError, NetworkError, FileError, BrowserError
|
|
162
|
+
|
|
163
|
+
commit 113aa52b8c10c3dceae6dab54fb793a713c85d48
|
|
164
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
165
|
+
Date: Thu Apr 2 11:31:34 2026 +0700
|
|
166
|
+
|
|
167
|
+
feat(errors): create abstract AppError base class with metadata
|
|
168
|
+
|
|
169
|
+
commit 632e1716941f317ef34e33131e8db22a745e812b
|
|
170
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
171
|
+
Date: Thu Apr 2 11:31:28 2026 +0700
|
|
172
|
+
|
|
173
|
+
feat(utils): add Result type and ok/err helper functions
|
|
174
|
+
|
|
175
|
+
commit 404af4c69d443e1722bb74aa9e5dbc4391dcd77e
|
|
176
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
177
|
+
Date: Thu Apr 2 11:31:28 2026 +0700
|
|
178
|
+
|
|
179
|
+
feat(utils): implement Logger class with level-based filtering
|
|
180
|
+
|
|
181
|
+
commit a590df93fe4476306a694f9475ae1ce27af74fd0
|
|
182
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
183
|
+
Date: Thu Apr 2 11:31:27 2026 +0700
|
|
184
|
+
|
|
185
|
+
feat(utils): add helper functions for filename sanitization and sleep
|
|
186
|
+
|
|
187
|
+
commit 02745291f00d47110f673b1b923f108e55e331fc
|
|
188
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
189
|
+
Date: Thu Apr 2 02:02:27 2026 +0700
|
|
190
|
+
|
|
191
|
+
remake prepublish scripts
|
|
192
|
+
|
|
193
|
+
commit a88b254acafbad32719b67c096fb3420ed813aa0
|
|
194
|
+
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
195
|
+
Date: Thu Apr 2 02:01:54 2026 +0700
|
|
196
|
+
|
|
197
|
+
release: v2.0.1
|
|
198
|
+
|
|
199
|
+
delete ci for auto publihs
|
|
200
|
+
|
|
1
201
|
commit c63b25ce873bcba391cf66dc52c3c04fb8eb9306
|
|
2
202
|
Author: neuxdotdev <neuxdev1@gmail.com>
|
|
3
203
|
Date: Thu Apr 2 01:50:16 2026 +0700
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sfiledl",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Implement and automate downloading of any file from sfile.co with javascripts library, written entirely in typescripts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/lib.cjs",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "AGPL-3.0-only",
|
|
10
10
|
"files": [
|
|
11
11
|
"build",
|
|
12
|
-
"readme",
|
|
12
|
+
"readme.md",
|
|
13
13
|
"license",
|
|
14
14
|
"changelog"
|
|
15
15
|
],
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"clean": "rm -rf build node_modules/.cache",
|
|
33
33
|
"typecheck": "tsc --noEmit",
|
|
34
34
|
"build:ts": "tsc",
|
|
35
|
-
"build:bundle": "rollup -c",
|
|
35
|
+
"build:bundle": "rollup -c rollup.config.ts --configPlugin typescript",
|
|
36
36
|
"build": "bun run clean && bun run typecheck && bun run build:ts && bun run build:bundle",
|
|
37
37
|
"dev:ts": "tsc --emitDeclarationOnly --outDir build --watch",
|
|
38
38
|
"build:prod": "NODE_ENV=production bun run build",
|
|
39
39
|
"dev": "rollup -c -w --bundleConfigAsCjs",
|
|
40
|
-
"format:build": "bun ./scripts/format-build.
|
|
40
|
+
"format:build": "bun ./scripts/format-build.ts",
|
|
41
41
|
"lint": "tsc --noEmit",
|
|
42
42
|
"format": "prettier . --write",
|
|
43
43
|
"format:check": "prettier . --check",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"bun",
|
|
58
58
|
"sfile-downloader"
|
|
59
59
|
],
|
|
60
|
-
"author": "neuxdotdev <
|
|
60
|
+
"author": "neuxdotdev <neuxdev1@gmail.com>",
|
|
61
61
|
"repository": {
|
|
62
62
|
"type": "git",
|
|
63
63
|
"url": "git+https://github.com/neuxdotdev/sfiledl.git"
|
|
@@ -65,20 +65,22 @@
|
|
|
65
65
|
"bugs": {
|
|
66
66
|
"url": "https://github.com/neuxdotdev/sfiledl/issues"
|
|
67
67
|
},
|
|
68
|
-
"homepage": "https://github.
|
|
68
|
+
"homepage": "https://neuxdotdev.github.io/sfiledl/",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"playwright": "^1.
|
|
70
|
+
"playwright": "^1.59.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@types/node": "^25.5.0",
|
|
74
73
|
"@rollup/plugin-commonjs": "^29.0.2",
|
|
75
74
|
"@rollup/plugin-json": "^6.1.0",
|
|
76
75
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
77
76
|
"@rollup/plugin-replace": "^6.0.3",
|
|
78
77
|
"@rollup/plugin-terser": "^1.0.0",
|
|
79
78
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
79
|
+
"@types/node": "^25.5.0",
|
|
80
|
+
"@types/rollup-plugin-peer-deps-external": "^2.2.6",
|
|
81
|
+
"docsify-cli": "^4.4.4",
|
|
80
82
|
"dts-bundle-generator": "^9.5.1",
|
|
81
|
-
"esbuild": "^0.27.
|
|
83
|
+
"esbuild": "^0.27.5",
|
|
82
84
|
"husky": "^9.1.7",
|
|
83
85
|
"prettier": "^3.8.1",
|
|
84
86
|
"rollup": "^4.60.1",
|
package/readme.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# sfiledl
|
|
2
|
+
|
|
3
|
+
> Implement and automate downloading of any file from https://sfile.co/ with javascripts library, written entirely in typescripts
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/sfiledl)
|
|
6
|
+
[](https://github.com/neuxdotdev/sfiledl/blob/main/license)
|
|
7
|
+
[](https://www.typescriptlang.org)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Using Bun (recommended)
|
|
15
|
+
bun add sfiledl
|
|
16
|
+
|
|
17
|
+
# Using npm
|
|
18
|
+
npm install sfiledl
|
|
19
|
+
|
|
20
|
+
# Install Playwright browser (required)
|
|
21
|
+
bunx playwright install chromium
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { downloadSfile } from 'sfiledl'
|
|
30
|
+
|
|
31
|
+
const result = await downloadSfile(
|
|
32
|
+
'https://sfile.co/file/abc123', // sfile.co URL
|
|
33
|
+
'./downloads', // Save directory
|
|
34
|
+
{ headless: true, debug: false }, // Optional options
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
console.log(result)
|
|
38
|
+
// {
|
|
39
|
+
// filePath: './downloads/file.zip',
|
|
40
|
+
// size: 1048576,
|
|
41
|
+
// method: 'direct' | 'fallback'
|
|
42
|
+
// }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## API Reference
|
|
48
|
+
|
|
49
|
+
### `downloadSfile(url, saveDir, options?)`
|
|
50
|
+
|
|
51
|
+
| Parameter | Type | Required | Description |
|
|
52
|
+
| --------- | ----------------- | -------- | -------------------------- |
|
|
53
|
+
| `url` | `string` | | sfile.co URL to download |
|
|
54
|
+
| `saveDir` | `string` | | Directory to save the file |
|
|
55
|
+
| `options` | `DownloadOptions` | | Optional configuration |
|
|
56
|
+
|
|
57
|
+
### `DownloadOptions`
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
interface DownloadOptions {
|
|
61
|
+
headless?: boolean // Run browser headless (default: true)
|
|
62
|
+
debug?: boolean // Enable debug logging (default: false)
|
|
63
|
+
userAgent?: string // Custom user agent string
|
|
64
|
+
timeout?: number // Operation timeout in ms (default: 100000)
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### `DownloadResult`
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
interface DownloadResult {
|
|
72
|
+
filePath: string // Full path to saved file
|
|
73
|
+
size: number // File size in bytes
|
|
74
|
+
method: 'direct' | 'fallback' // Download strategy used
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Error Handling
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { downloadSfile, ValidationError, NetworkError } from 'sfiledl'
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
await downloadSfile('https://sfile.co/file/xyz', './out')
|
|
87
|
+
} catch (err) {
|
|
88
|
+
if (err instanceof ValidationError) {
|
|
89
|
+
console.error('Invalid input:', err.message)
|
|
90
|
+
}
|
|
91
|
+
if (err instanceof NetworkError && err.retryable) {
|
|
92
|
+
console.log('Network issue, retry possible')
|
|
93
|
+
}
|
|
94
|
+
// All errors include: code, timestamp, context, retryable flag
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Error Types
|
|
99
|
+
|
|
100
|
+
| Error | Code | Retryable | When |
|
|
101
|
+
| ----------------- | ------------------ | --------- | -------------------------- |
|
|
102
|
+
| `ValidationError` | `VALIDATION_ERROR` | | Invalid URL or input |
|
|
103
|
+
| `NetworkError` | `NETWORK_ERROR` | | Navigation/fetch failures |
|
|
104
|
+
| `FileError` | `FILE_ERROR` | | File system issues |
|
|
105
|
+
| `BrowserError` | `BROWSER_ERROR` | | Playwright launch failures |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Debug Mode
|
|
110
|
+
|
|
111
|
+
Enable `debug: true` for verbose logging:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
await downloadSfile(url, './out', { debug: true })
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
On error, debug artifacts are auto-saved to `/tmp/sfile_debug_<timestamp>/`:
|
|
118
|
+
|
|
119
|
+
- `error.png` — Full page screenshot
|
|
120
|
+
- `error.html` — Page source at failure
|
|
121
|
+
- `error.txt` — Error message
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Development
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Clone & install
|
|
129
|
+
git clone https://github.com/neuxdotdev/sfiledl.git
|
|
130
|
+
cd sfiledl
|
|
131
|
+
bun install
|
|
132
|
+
bunx playwright install chromium
|
|
133
|
+
# Rebuild (clean + lint + build + format)
|
|
134
|
+
bun run rebuild
|
|
135
|
+
|
|
136
|
+
# Run tests
|
|
137
|
+
bun run test
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Contributing
|
|
143
|
+
|
|
144
|
+
1. Fork the repository
|
|
145
|
+
2. Create a feature branch (`git checkout -b feat/your-feature`)
|
|
146
|
+
3. Commit changes (`git commit -m 'feat: add your feature'`)
|
|
147
|
+
4. Push to branch (`git push origin feat/your-feature`)
|
|
148
|
+
5. Open a Pull Request
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
**AGPL-3.0-only** — See [LICENSE](license) for details.
|
|
155
|
+
|
|
156
|
+
> This license ensures that any network-distributed modifications remain open source.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Credits
|
|
161
|
+
|
|
162
|
+
- Built with [Playwright](https://playwright.dev) for reliable automation
|
|
163
|
+
- Optimized for [Bun](https://bun.sh) runtime performance
|
|
164
|
+
- Inspired by the need for simple, scriptable file downloads
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
> **Repository**: https://github.com/neuxdotdev/sfiledl
|
|
169
|
+
> **Issues**: https://github.com/neuxdotdev/sfiledl/issues
|
|
170
|
+
> **npm**: https://www.npmjs.com/package/sfiledl
|
package/readme
DELETED