MCPcopy
hub / github.com/CapSoftware/Cap / create

Method create

packages/recorder-core/src/recording-spool.ts:228–254  ·  view source on GitHub ↗
(
		options: {
			mimeType: string;
			sessionId?: string;
			maxPendingChunkBytes?: number;
		},
		backend: RecordingSpoolBackend = new IndexedDbRecordingSpoolBackend(),
	)

Source from the content-addressed store, hash-verified

226 }
227
228 static async create(
229 options: {
230 mimeType: string;
231 sessionId?: string;
232 maxPendingChunkBytes?: number;
233 },
234 backend: RecordingSpoolBackend = new IndexedDbRecordingSpoolBackend(),
235 ) {
236 const now = Date.now();
237 const session = {
238 sessionId: options.sessionId ?? createSessionId(),
239 mimeType: options.mimeType,
240 totalBytes: 0,
241 chunkCount: 0,
242 createdAt: now,
243 updatedAt: now,
244 } satisfies RecordingSpoolSessionRecord;
245
246 await backend.initialize();
247 await backend.createSession(session);
248
249 return new RecordingSpool(
250 backend,
251 session,
252 options.maxPendingChunkBytes ?? DEFAULT_MAX_PENDING_CHUNK_BYTES,
253 );
254 }
255
256 get sessionId() {
257 return this.session.sessionId;

Callers 1

Calls 3

createSessionIdFunction · 0.85
initializeMethod · 0.65
createSessionMethod · 0.65

Tested by

no test coverage detected