Skip to main content

Posts

Showing posts with the label zip and download files with ReactJS

zip photos and download from react app -

library:  jszip -  const zip = jszip () file-saver -  saveAs ( content , ` ${ fetchListingId } .zip` ) issue: cors -  the original plan was download photos from the front end and zip with jszip, but got cors error when download from firebase storage solutions: 1. on graphql, add query:  getPhotosBuffer(listingId: String): [PhotoBuffer] to return stringified buffer of photos fetchPhotosBuffer = async ( listingId : string ): Promise < PhotoBuffer []> => this . cacheProvider . processor < PhotoBuffer []>( async () => { const photos = await this . collection . where ( 'listingId' , '==' , listingId ) . orderBy ( 'orders' ) . get () const result : PhotoBuffer [] = [] await Promise . all ( photos . docs . map ( async ( photo : any ) => { const data = photo . data () const { photoUrl } = data try { const bu...