@zaruikes/epubjs-core
Version:
A digital book reader in .opf .epub format for react native using epub.js library inside a webview.
16 lines • 470 B
JavaScript
import { SourceType } from './enums/source-type.enum';
import { getSourceType } from './getSourceType';
export function getSourceName(source) {
const extension = getSourceType(source);
const randomName = Date.now().toString();
if (extension === SourceType.BASE64) {
return randomName;
}
if (extension === SourceType.EPUB) {
return `${randomName}.epub`;
}
if (extension === SourceType.OPF) {
return `${randomName}.opf`;
}
return undefined;
}