<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: swipra</title>
    <description>The latest articles on DEV Community by swipra (@sishere4u).</description>
    <link>https://dev.to/sishere4u</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F848466%2F587c4b11-c770-47da-b435-dafad913f2f6.jpeg</url>
      <title>DEV Community: swipra</title>
      <link>https://dev.to/sishere4u</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sishere4u"/>
    <language>en</language>
    <item>
      <title>How to get the unzipping done first before executing the observable post</title>
      <dc:creator>swipra</dc:creator>
      <pubDate>Fri, 03 Jun 2022 10:36:52 +0000</pubDate>
      <link>https://dev.to/sishere4u/how-to-get-the-unzipping-done-first-before-executing-the-observable-post-2mo4</link>
      <guid>https://dev.to/sishere4u/how-to-get-the-unzipping-done-first-before-executing-the-observable-post-2mo4</guid>
      <description>&lt;p&gt;Need to get unzipped files and store into an array files. Then need to upload the array of files. There is a need of some delay between the unzipping using loadAsSync and post ( to import). Here Post is executed before unzipping. Any help is much appreciated&lt;/p&gt;

&lt;p&gt;code-snippets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;selectedfiles: File[] = [];

// Unzip and stores files into selectedfiles. 

readZip(file: any) {
    var jsZip = require('jszip')
    this.selectedfiles = [];

    jsZip.loadAsync(file).then((zip) =&amp;gt; {
      Object.keys(zip.files).forEach((filename) =&amp;gt; {
        zip.files[filename].async('blob').then((fileData) =&amp;gt; {

          if (!zip.files[filename].dir) {
            const tmp = new File([fileData], filename);
            this.selectedfiles.push(tmp);
          }
        });
      });
    });
  }

// To upload the selected zip file
  upload(files: FileList): Observable&amp;lt;HttpEvent&amp;lt;Blob&amp;gt;&amp;gt; {
    const url = `${this.apiroot}/device/wifi/settings`;
    const formData = new FormData();

    this.readZip(files[0]) //stores files into selectedfiles 

     this.selectedfiles.forEach((value) =&amp;gt; {
        formData.append('file', value);
      });

    return this.http.post&amp;lt;HttpResponse&amp;lt;DSettings&amp;gt;&amp;gt;(url, formData, { observe: 'events', reportProgress: true }).pipe(
      tap(() =&amp;gt; {
        this.log('uploaded settings');
        this.selectedfiles = [];
      }),
      catchError(this.handleError&amp;lt;DSettings&amp;gt;('upload'))
    );
  }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>angular</category>
    </item>
    <item>
      <title>downloading files as Zip using angular 13</title>
      <dc:creator>swipra</dc:creator>
      <pubDate>Tue, 26 Apr 2022 06:33:19 +0000</pubDate>
      <link>https://dev.to/sishere4u/downloading-files-as-zip-using-angular-13-41cc</link>
      <guid>https://dev.to/sishere4u/downloading-files-as-zip-using-angular-13-41cc</guid>
      <description>&lt;p&gt;I'm facing issues in downloading files as Zip using angular 13.&lt;br&gt;
It downloads as zip but looks like zip file gets corrupted.&lt;/p&gt;

&lt;p&gt;But the zip file has size.&lt;/p&gt;

&lt;p&gt;Any help is much appreciated.&lt;/p&gt;

</description>
      <category>angular</category>
    </item>
  </channel>
</rss>
