Skip to content

Commit

Permalink
fix: use default import for the library "file-type" to support ESM (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdulazeez-98 authored Feb 19, 2023
1 parent fad22e6 commit 8f6a0fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios, { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosRequestHeaders } from 'axios';
import { fromBuffer } from 'file-type';
import fileType from 'file-type';
import { ReadStream } from 'fs';
import { createHash } from 'node:crypto';
import { BunnyCdnStreamError } from './error';
Expand Down Expand Up @@ -310,7 +310,7 @@ export class BunnyCdnStream {

if (typeof thumbnail !== 'string')
options.headers['Content-Type'] =
thumbnail instanceof ReadStream ? 'application/octet-stream' : (ct || (await fromBuffer(thumbnail)) || { mime: 'image/jpg' }).mime;
thumbnail instanceof ReadStream ? 'application/octet-stream' : (ct || (await fileType.fromBuffer(thumbnail)) || { mime: 'image/jpg' }).mime;

options.url += `/library/${this.options.videoLibrary}/videos/${videoId}/thumbnail`;
options.method = 'POST';
Expand Down

0 comments on commit 8f6a0fc

Please sign in to comment.