|
@@ -1,5 +1,5 @@
|
|
|
/**
|
|
|
- * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
*
|
|
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
|
*/
|
|
@@ -11,17 +11,12 @@ export type FileInput = File | Blob | string
|
|
|
// TODO store globally with decompression plugins?
|
|
|
const compressedExtList = ['gz', 'zip'];
|
|
|
|
|
|
-// TODO store globally with parser plugins?
|
|
|
-const binaryExtList = ['bcif', 'ccp4', 'dcd'];
|
|
|
-
|
|
|
export interface FileInfo {
|
|
|
path: string
|
|
|
name: string
|
|
|
ext: string
|
|
|
base: string
|
|
|
dir: string
|
|
|
- compressed: string | boolean
|
|
|
- binary: boolean
|
|
|
protocol: string
|
|
|
query: string
|
|
|
src: FileInput
|
|
@@ -29,7 +24,6 @@ export interface FileInfo {
|
|
|
|
|
|
export function getFileInfo(file: FileInput): FileInfo {
|
|
|
let path: string;
|
|
|
- let compressed: string|false;
|
|
|
let protocol = '';
|
|
|
|
|
|
if (file instanceof File) {
|
|
@@ -58,16 +52,11 @@ export function getFileInfo(file: FileInput): FileInfo {
|
|
|
const dir = path.substring(0, path.lastIndexOf('/') + 1);
|
|
|
|
|
|
if (compressedExtList.includes(ext)) {
|
|
|
- compressed = ext;
|
|
|
const n = path.length - ext.length - 1;
|
|
|
ext = (path.substr(0, n).split('.').pop() || '').toLowerCase();
|
|
|
const m = base.length - ext.length - 1;
|
|
|
base = base.substr(0, m);
|
|
|
- } else {
|
|
|
- compressed = false;
|
|
|
}
|
|
|
|
|
|
- const binary = binaryExtList.includes(ext);
|
|
|
-
|
|
|
- return { path, name, ext, base, dir, compressed, binary, protocol, query, src: file };
|
|
|
+ return { path, name, ext, base, dir, protocol, query, src: file };
|
|
|
}
|