Skip to content

Commit 056f543

Browse files
authored
fix(File): check stream in node.js only (#489)
1 parent f4a55aa commit 056f543

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/uploader/s3.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ module.exports = function upload(uploadInfo, data, file, saveOptions = {}) {
2626
reject(handleError(res.error, res));
2727
});
2828
req.on('error', (err, res) => reject(handleError(err, res)));
29-
if (require('stream') && data instanceof require('stream')) {
30-
// data.pipe(req);
31-
throw new TypeError('Saving an AV.File from a Stream to S3 is not yet supported');
32-
} else {
33-
req.send(data).end();
29+
if (!process.env.CLIENT_PLATFORM) {
30+
if (data instanceof require('stream')) {
31+
// data.pipe(req);
32+
throw new TypeError('Saving an AV.File from a Stream to S3 is not yet supported');
33+
}
3434
}
35+
req.send(data).end();
3536
});
3637
};

webpack/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports.create = () => ({
1919
node: {
2020
// do not polyfill Buffer
2121
Buffer: false,
22-
stream: 'empty',
22+
stream: false,
2323
process: false,
2424
},
2525
module: {

0 commit comments

Comments
 (0)