SnowLuma v2.4.2 source snapshot
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:02:00 +08:00
commit fa9c73363d
1367 files changed
+355735

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { openAsBlob } from 'node:fs';
import { stat } from 'node:fs/promises';
import { basename, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { NamedMediaSource } from '../types/index.js';
export {
createReverseWebSocketServer,
SnowLumaReverseWebSocketServer,
type SnowLumaReverseWebSocketSession,
type ReverseWebSocketServerOptions,
type ReverseWebSocketServerEvents,
} from './reverse-websocket-server.js';
/** Opens a file-backed source without buffering the entire file in memory.
* Keep the file unchanged until the send finishes; read failures are propagated. */
export async function localFile(path: string | URL): Promise<NamedMediaSource> {
const absolutePath = path instanceof URL ? fileURLToPath(path) : resolve(path);
const info = await stat(absolutePath);
if (!info.isFile()) {
throw new TypeError('localFile() requires a regular file');
}
return { source: await openAsBlob(absolutePath), filename: basename(absolutePath) };
}