Add MIME.APPLICATION_OCTET_STREAM
This commit is contained in:
parent
c8be066391
commit
8a4f062120
2 changed files with 5 additions and 5 deletions
|
@ -4,11 +4,11 @@ import moment from 'moment';
|
|||
import * as GoogleChrome from '../util/GoogleChrome';
|
||||
import { saveURLAsFile } from '../util/saveURLAsFile';
|
||||
import { arrayBufferToObjectURL } from '../util/arrayBufferToObjectURL';
|
||||
import { MIMEType } from './MIME';
|
||||
import * as MIME from './MIME';
|
||||
|
||||
export type Attachment = {
|
||||
fileName?: string;
|
||||
contentType?: MIMEType;
|
||||
contentType?: MIME.MIMEType;
|
||||
size?: number;
|
||||
data: ArrayBuffer;
|
||||
|
||||
|
@ -27,8 +27,6 @@ interface AttachmentSchemaVersion3 {
|
|||
path: string;
|
||||
}
|
||||
|
||||
const SAVE_CONTENT_TYPE = 'application/octet-stream' as MIMEType;
|
||||
|
||||
export const isVisualMedia = (attachment: Attachment): boolean => {
|
||||
const { contentType } = attachment;
|
||||
|
||||
|
@ -57,7 +55,7 @@ export const save = ({
|
|||
? getAbsolutePath(attachment.path)
|
||||
: arrayBufferToObjectURL({
|
||||
data: attachment.data,
|
||||
type: SAVE_CONTENT_TYPE,
|
||||
type: MIME.APPLICATION_OCTET_STREAM,
|
||||
});
|
||||
const filename = getSuggestedFilename({ attachment, timestamp });
|
||||
saveURLAsFile({ url, filename, document });
|
||||
|
|
|
@ -4,3 +4,5 @@ export const isJPEG = (value: MIMEType): boolean => value === 'image/jpeg';
|
|||
export const isImage = (value: MIMEType): boolean => value.startsWith('image/');
|
||||
export const isVideo = (value: MIMEType): boolean => value.startsWith('video/');
|
||||
export const isAudio = (value: MIMEType): boolean => value.startsWith('audio/');
|
||||
|
||||
export const APPLICATION_OCTET_STREAM = 'application/octet-stream' as MIMEType;
|
||||
|
|
Loading…
Reference in a new issue