28 lines
556 B
TypeScript
28 lines
556 B
TypeScript
import type { ImportSource, ImportSourceMetadata } from '../../src/domain/import-source';
|
|
|
|
export function sourceMetadata(
|
|
name: string,
|
|
sizeBytes = 0,
|
|
mediaType = '',
|
|
lastModified = 1234
|
|
): ImportSourceMetadata {
|
|
return {
|
|
name,
|
|
sizeBytes,
|
|
lastModified,
|
|
...(mediaType ? { mediaType } : {})
|
|
};
|
|
}
|
|
|
|
export function binarySource(
|
|
name: string,
|
|
bytes: Uint8Array,
|
|
mediaType = '',
|
|
lastModified = 1234
|
|
): ImportSource {
|
|
return {
|
|
metadata: sourceMetadata(name, bytes.byteLength, mediaType, lastModified),
|
|
bytes
|
|
};
|
|
}
|