Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
downloadFile(filePath) {
console.warn(
"firebase.storage.Reference.downloadFile() is deprecated, please rename usages to 'writeToFile()'",
);
return this.writeToFile(toFilePath(filePath));
}
return new StorageDownloadTask(this, task =>
this._storage.native.writeToFile(this.toString(), toFilePath(filePath), task._id),
);
);
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().imageLabelerProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionImageLabelerOptions(imageLabelerOptions);
} catch (e) {
throw new Error(`firebase.vision().imageLabelerProcessImage(_, *) ${e.message}.`);
}
return this.native.imageLabelerProcessImage(toFilePath(localImageFilePath), options);
}
);
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().cloudImageLabelerProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionCloudImageLabelerOptions(cloudImageLabelerOptions);
} catch (e) {
throw new Error(`firebase.vision().cloudImageLabelerProcessImage(_, *) ${e.message}.`);
}
return this.native.cloudImageLabelerProcessImage(toFilePath(localImageFilePath), options);
}
cloudTextRecognizerProcessImage(localImageFilePath, cloudTextRecognizerOptions) {
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().cloudTextRecognizerProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionCloudTextRecognizerOptions(cloudTextRecognizerOptions);
} catch (e) {
throw new Error(`firebase.vision().cloudTextRecognizerProcessImage(_, *) ${e.message}`);
}
return this.native.cloudTextRecognizerProcessImage(toFilePath(localImageFilePath), options);
}
throw new Error(
"firebase.vision().cloudDocumentTextRecognizerProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionCloudDocumentTextRecognizerOptions(cloudDocumentTextRecognizerOptions);
} catch (e) {
throw new Error(
`firebase.vision().cloudDocumentTextRecognizerProcessImage(_, *) ${e.message}.`,
);
}
return this.native.cloudDocumentTextRecognizerProcessImage(
toFilePath(localImageFilePath),
options,
);
}
cloudLandmarkRecognizerProcessImage(localImageFilePath, cloudLandmarkRecognizerOptions) {
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().cloudLandmarkRecognizerProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionCloudLandmarkRecognizerOptions(cloudLandmarkRecognizerOptions);
} catch (e) {
throw new Error(`firebase.vision().cloudLandmarkRecognizerProcessImage(_, *) ${e.message}.`);
}
return this.native.cloudLandmarkRecognizerProcessImage(toFilePath(localImageFilePath), options);
}
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().faceDetectorProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionFaceDetectorOptions(faceDetectorOptions);
} catch (e) {
throw new Error(
`firebase.vision().faceDetectorProcessImage(_, *) 'faceDetectorOptions' ${e.message}.`,
);
}
return this.native.faceDetectorProcessImage(toFilePath(localImageFilePath), options);
}
return new StorageUploadTask(this, task =>
this._storage.native.putFile(this.toString(), toFilePath(filePath), metadata, task._id),
);
barcodeDetectorProcessImage(localImageFilePath, barcodeDetectorOptions) {
if (!isString(localImageFilePath)) {
throw new Error(
"firebase.vision().barcodeDetectorProcessImage(*) 'localImageFilePath' expected a string local file path.",
);
}
let options;
try {
options = visionBarcodeDetectorOptions(barcodeDetectorOptions);
} catch (e) {
throw new Error(`firebase.vision().barcodeDetectorProcessImage(_, *) ${e.message}`);
}
return this.native.barcodeDetectorProcessImage(toFilePath(localImageFilePath), options);
}
}