Skip to content

Commit 21011da

Browse files
committed
Implement Read Function
1 parent e41a174 commit 21011da

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/firebase.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,15 @@ export default class FirebaseStorageAdapter extends BaseAdapter {
4848
};
4949
const uploadOptions = {
5050
...(this.uploadOptions ? this.uploadOptions : defaultUploadOptions),
51-
destination: pathToSave.split(sep).join(posix.sep),
51+
destination: pathToSave.split(sep).join(posix.sep),
5252
};
5353
const data = await this.bucket.upload(image.path, uploadOptions);
5454
if (this.domainName) {
5555
const domainName = new URL(this.domainName);
5656
const downloadPath = new URL(data[1].name, domainName).toString();
57-
console.log({ downloadPath });
5857
return downloadPath;
5958
}
6059
const link = data[1].mediaLink;
61-
console.log({ link });
6260
return link;
6361
}
6462

@@ -81,7 +79,8 @@ export default class FirebaseStorageAdapter extends BaseAdapter {
8179
if (!options) {
8280
return new Promise((resolve, reject) => reject('Options can not be undefined'));
8381
}
84-
const rs = this.bucket.file(options.path).createReadStream();
82+
const filePath = this.getTargetDir(this.basePath);
83+
const rs = this.bucket.file(filePath).createReadStream();
8584
let contents: unknown = null;
8685
return new Promise(function (resolve, reject) {
8786
rs.on('error', function (err) {

0 commit comments

Comments
 (0)