Skip to content

Commit

Permalink
Fixed the problem that lower version of nodejs does not support File
Browse files Browse the repository at this point in the history
  • Loading branch information
iteyelmp committed Aug 12, 2024
1 parent ee6e4e6 commit ab700f9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ export function isBuffer(content) {
}

export function isFile(content) {
const isNodeFile = content && typeof content === 'object' &&
typeof content.isNodeJs === 'boolean' &&
content.isNodeJs;
return (content instanceof File) || isNodeFile;
if (isNodejs()) {
return content && typeof content === 'object' &&
typeof content.isNodeJs === 'boolean' &&
content.isNodeJs;
} else {
return content instanceof File;
}
}

export function isNodejs() {
return typeof process !== 'undefined' && !!process.versions && !!process.versions.node;
}

0 comments on commit ab700f9

Please sign in to comment.