Created
March 3, 2020 14:42
-
-
Save stephenplusplus/c20d164ff46aefe0fc0a7165667534a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/table.ts b/src/table.ts | |
index cbe2d59..e900829 100644 | |
--- a/src/table.ts | |
+++ b/src/table.ts | |
@@ -1102,20 +1102,16 @@ class Table extends common.ServiceObject { | |
this.bigQuery.createJob(body, callback!); | |
} | |
- createLoadJob(source: string, metadata?: JobLoadMetadata): Writable; | |
- createLoadJob(source: File, metadata?: JobLoadMetadata): Promise<JobResponse>; | |
createLoadJob( | |
- source: string, | |
- metadata: JobLoadMetadata, | |
- callback: JobCallback | |
- ): Writable; | |
+ source: string | File, | |
+ metadata?: JobLoadMetadata | |
+ ): Promise<JobResponse>; | |
createLoadJob( | |
- source: File, | |
+ source: string | File, | |
metadata: JobLoadMetadata, | |
callback: JobCallback | |
): void; | |
- createLoadJob(source: string, callback: JobCallback): Writable; | |
- createLoadJob(source: File, callback: JobCallback): void; | |
+ createLoadJob(source: string | File, callback: JobCallback): void; | |
/** | |
* Load data from a local file or Storage {@link | |
* https://cloud.google.com/nodejs/docs/reference/storage/latest/File File}. | |
@@ -1206,7 +1202,7 @@ class Table extends common.ServiceObject { | |
source: string | File, | |
metadataOrCallback?: JobLoadMetadata | JobCallback, | |
cb?: JobCallback | |
- ): void | Promise<JobResponse> | Writable { | |
+ ): void | Promise<JobResponse> { | |
const metadata = | |
typeof metadataOrCallback === 'object' ? metadataOrCallback : {}; | |
const callback = | |
@@ -1238,13 +1234,13 @@ class Table extends common.ServiceObject { | |
} | |
// Read the file into a new write stream. | |
- return fs | |
- .createReadStream(source) | |
+ fs.createReadStream(source) | |
.pipe(this.createWriteStream_(metadata)) | |
.on('error', callback) | |
.on('job', job => { | |
callback(null, job, job.metadata); | |
}); | |
+ return; | |
} | |
// tslint:disable-next-line no-any |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment