Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

create file object from url typescript

fetch('//my-image-url')
      .then((e) => {
        return e.blob()
      })
      .then((blob) => {
        let b: any = blob
        b.lastModifiedDate = new Date()
        b.name = ''
        return b as File
      })
// Promise returning a File Object
// (usefull for previewing image in updating forms)
 
PREVIOUS NEXT
Tagged: #create #file #object #url #typescript
ADD COMMENT
Topic
Name
1+4 =