Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sourceUris: arrify(source).map((src) => {
if (!util.isCustomType(src, 'storage/file')) {
throw new Error('Source must be a File object.');
}
// If no explicit format was provided, attempt to find a match from
// the file's extension. If no match, don't set, and default upstream
// to CSV.
const format =
FORMATS[
path
.extname(src.name)
.substr(1)
.toLowerCase()
];
if (!metadata.sourceFormat && format) {
body.configuration.load.sourceFormat = format;
}
destinationUris: arrify(destination).map((dest) => {
if (!util.isCustomType(dest, 'storage/file')) {
throw new Error('Destination must be a File object.');
}
// If no explicit format was provided, attempt to find a match from the
// file's extension. If no match, don't set, and default upstream to CSV.
const format = path
.extname(dest.name)
.substr(1)
.toLowerCase();
if (!options.destinationFormat && !options.format && FORMATS[format]) {
options.destinationFormat = FORMATS[format];
}
return 'gs://' + dest.bucket.name + '/' + dest.name;
}),
});