( ref: Reference, injector?: Injector )
| 23 | * creates observable methods from promise based methods. |
| 24 | */ |
| 25 | export function createStorageRef( |
| 26 | ref: Reference, |
| 27 | injector?: Injector |
| 28 | ): AngularFireStorageReference { |
| 29 | return { |
| 30 | getDownloadURL: () => of(undefined).pipe( |
| 31 | observeOn(injector.get(ɵAngularFireSchedulers).outsideAngular), |
| 32 | switchMap(() => ref.getDownloadURL()), |
| 33 | pendingUntilEvent(injector) |
| 34 | ), |
| 35 | getMetadata: () => of(undefined).pipe( |
| 36 | observeOn(injector.get(ɵAngularFireSchedulers).outsideAngular), |
| 37 | switchMap(() => ref.getMetadata()), |
| 38 | pendingUntilEvent(injector) |
| 39 | ), |
| 40 | delete: () => from(ref.delete()), |
| 41 | child: (path: string) => createStorageRef(ref.child(path), injector), |
| 42 | updateMetadata: (meta: SettableMetadata) => from(ref.updateMetadata(meta)), |
| 43 | put: (data: any, metadata?: UploadMetadata) => { |
| 44 | const task = ref.put(data, metadata); |
| 45 | return createUploadTask(task); |
| 46 | }, |
| 47 | putString: (data: string, format?: StringFormat, metadata?: UploadMetadata) => { |
| 48 | const task = ref.putString(data, format, metadata); |
| 49 | return createUploadTask(task); |
| 50 | }, |
| 51 | list: (options?: ListOptions) => from(ref.list(options)), |
| 52 | listAll: () => from(ref.listAll()) |
| 53 | }; |
| 54 | } |
no test coverage detected