create file object from url typescript

Solutions on MaxInterview for create file object from url typescript by the best coders in the world

showing results for - "create file object from url typescript"
Florencia
18 Mar 2019
1fetch('//my-image-url')
2      .then((e) => {
3        return e.blob()
4      })
5      .then((blob) => {
6        let b: any = blob
7        b.lastModifiedDate = new Date()
8        b.name = ''
9        return b as File
10      })
11// Promise returning a File Object
12// (usefull for previewing image in updating forms)