Skip to content

Commit

Permalink
fix buffer error
Browse files Browse the repository at this point in the history
  • Loading branch information
thiyaguk09 committed Feb 3, 2025
1 parent 509c216 commit 6320862
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2318,8 +2318,12 @@ class File extends ServiceObject<File, FileMetadata> {
writable.write(data);
fileStream
.pipe(writable)
.on('error', callback)
.on('finish', callback);
.on('error', (err: Error) => {
callback(err, Buffer.from(''));
})
.on('finish', () => {
callback(null, data);
});
})
.on('end', () => {
// In the case of an empty file no data will be received before the end event fires
Expand Down

0 comments on commit 6320862

Please sign in to comment.