| 349 | } |
| 350 | |
| 351 | export class Reference implements IReference { |
| 352 | _native: FIRStorageReference; |
| 353 | |
| 354 | static fromNative(value: FIRStorageReference) { |
| 355 | if (value instanceof FIRStorageReference) { |
| 356 | const ref = new Reference(); |
| 357 | ref._native = value; |
| 358 | return ref; |
| 359 | } |
| 360 | return null; |
| 361 | } |
| 362 | |
| 363 | get native() { |
| 364 | return this._native; |
| 365 | } |
| 366 | |
| 367 | get ios() { |
| 368 | return this.native; |
| 369 | } |
| 370 | |
| 371 | get bucket(): string { |
| 372 | return this.native?.bucket; |
| 373 | } |
| 374 | |
| 375 | get fullPath(): string { |
| 376 | return this.native?.fullPath; |
| 377 | } |
| 378 | |
| 379 | get name(): string { |
| 380 | return this.native?.name; |
| 381 | } |
| 382 | |
| 383 | get parent(): Reference { |
| 384 | return Reference.fromNative(this.native.parent()); |
| 385 | } |
| 386 | |
| 387 | get root(): Reference { |
| 388 | return Reference.fromNative(this.native.root()); |
| 389 | } |
| 390 | |
| 391 | get storage() { |
| 392 | return Storage.fromNative(this.native.storage); |
| 393 | } |
| 394 | |
| 395 | child(path: string): Reference { |
| 396 | return Reference.fromNative(this.native.child(path)); |
| 397 | } |
| 398 | |
| 399 | delete(): Promise<void> { |
| 400 | return new Promise((resolve, reject) => { |
| 401 | this.native.deleteWithCompletion((error) => { |
| 402 | if (error) { |
| 403 | reject(FirebaseError.fromNative(error)); |
| 404 | } else { |
| 405 | resolve(); |
| 406 | } |
| 407 | }); |
| 408 | }); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…