Skip to content

Commit 0414588

Browse files
committed
Add support for pdf and zip binary types
1 parent 6198638 commit 0414588

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/drive.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,25 @@ export class FileSystemDrive implements Contents.IDrive {
375375
let format: Contents.FileFormat;
376376
let fileContent: any = null;
377377

378-
// We assume here image, audio and video mimetypes are all and only binary files we'll encounter
378+
// We assume here image, audio, video, zip and pdf mimetypes are all and only binary files we'll encounter
379379
if (
380380
file.type &&
381381
file.type.split('/') &&
382382
['image', 'audio', 'video'].includes(file.type.split('/')[0])
383383
) {
384384
format = 'base64';
385385
} else {
386-
format = 'text';
386+
if (
387+
[
388+
'application/zip',
389+
'application/pdf',
390+
'application/octet-stream'
391+
].includes(file.type)
392+
) {
393+
format = 'base64';
394+
} else {
395+
format = 'text';
396+
}
387397
}
388398

389399
if (content) {

0 commit comments

Comments
 (0)