We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b641322 commit c51cd94Copy full SHA for c51cd94
src/file.ts
@@ -2173,8 +2173,14 @@ class File extends ServiceObject<File, FileMetadata> {
2173
.on('end', () => {
2174
// In the case of an empty file no data will be received before the end event fires
2175
if (!receivedData) {
2176
- fs.openSync(destination, 'w');
2177
- callback(null, Buffer.alloc(0));
+ const data = Buffer.alloc(0);
+
2178
+ try {
2179
+ fs.writeFileSync(destination, data);
2180
+ callback(null, data);
2181
+ } catch (e) {
2182
+ callback(e as Error, data);
2183
+ }
2184
}
2185
});
2186
} else {
0 commit comments