Skip to content

Commit

Permalink
feat: remove proto._statFile (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
microJ authored Apr 21, 2020
1 parent 20f40a7 commit fed2ba7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
7 changes: 2 additions & 5 deletions lib/browser/managed-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,9 @@ proto._getFileSize = async function _getFileSize(file) {
return file.length;
} else if (is.blob(file) || is.file(file)) {
return file.size;
} if (is.string(file)) {
const stat = await this._statFile(file);
return stat.size;
}

throw new Error('_getFileSize requires Buffer/File/String.');
throw new Error('_getFileSize requires Buffer/File/Blob.');
};

/*
Expand Down Expand Up @@ -300,7 +297,7 @@ proto._createStream = function _createStream(file, start, end) {
// });
// }

throw new Error('_createStream requires File/String.');
throw new Error('_createStream requires File/Blob.');
};

proto._getPartSize = function _getPartSize(fileSize, partSize) {
Expand Down
12 changes: 0 additions & 12 deletions lib/browser/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,18 +509,6 @@ proto._objectName = function _objectName(name) {
return name.replace(/^\/+/, '');
};

proto._statFile = function _statFile(filepath) {
return new Promise((resolve, reject) => {
fs.stat(filepath, (err, stats) => {
if (err) {
reject(err);
} else {
resolve(stats);
}
});
});
};

proto._convertMetaToHeaders = function _convertMetaToHeaders(meta, headers) {
if (!meta) {
return;
Expand Down

0 comments on commit fed2ba7

Please sign in to comment.