<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unzipping a file with newest DT capability in Developer Q&amp;A Forum</title>
    <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229261#M634</link>
    <description>&lt;P&gt;Thank you very much - a lot of learning and nuance (also due to language barrier) for me.&lt;BR /&gt;&lt;BR /&gt;I'll do my best&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2023 09:15:34 GMT</pubDate>
    <dc:creator>y_buccellato</dc:creator>
    <dc:date>2023-11-20T09:15:34Z</dc:date>
    <item>
      <title>Unzipping a file with newest DT capability</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229068#M623</link>
      <description>&lt;P&gt;I currently am asked to download some trace log from SAP CPI API.&lt;/P&gt;&lt;P&gt;The called API gets back a log file in a .zip format.&lt;BR /&gt;&lt;BR /&gt;Is it possible to download and unpack the zip in the same code snipped via some Dynatrace feature to then ingest those log data?&lt;BR /&gt;&lt;BR /&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 11:09:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229068#M623</guid>
      <dc:creator>y_buccellato</dc:creator>
      <dc:date>2023-11-17T11:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unzipping a file with newest DT capability</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229228#M631</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/4804"&gt;@y_buccellato&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Yes, this is possible. Let me give you a rough outline of what you need:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;access the external API from an app function: &lt;A href="https://developer.dynatrace.com/develop/functions/" target="_blank"&gt;https://developer.dynatrace.com/develop/functions/&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;download the ZIP with &lt;CODE&gt;fetch("https://...")&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;extract the info you want from the ZIP file&lt;/LI&gt;
&lt;LI&gt;ingest the logs via&amp;nbsp;&lt;A href="https://developer.dynatrace.com/reference/sdks/client-classic-environment-v2/#storelog" target="_blank"&gt;https://developer.dynatrace.com/reference/sdks/client-classic-environment-v2/#storelog&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The handling of the ZIP file is the most tricky part. I just tried &lt;A href="https://gildas-lormeau.github.io/zip.js/" target="_self"&gt;zip.js&lt;/A&gt;&amp;nbsp;and came up with the following snippet for an app function:&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; { &lt;/SPAN&gt;&lt;SPAN&gt;BlobReader&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;TextWriter&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;ZipReader&lt;/SPAN&gt;&lt;SPAN&gt; } &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"@zip.js/zip.js"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;export&lt;/SPAN&gt; &lt;SPAN&gt;default&lt;/SPAN&gt; &lt;SPAN&gt;async&lt;/SPAN&gt; &lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; () {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;zipFile&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;fetch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"https://developer.dynatrace.com/zips/gettingStarted/finalproject.zip"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;blob&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;zipFile&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;blob&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;reader&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;ZipReader&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;BlobReader&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;blob&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;entries&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;reader&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getEntries&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;entry&lt;/SPAN&gt; &lt;SPAN&gt;of&lt;/SPAN&gt; &lt;SPAN&gt;entries&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;entry&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;filename&lt;/SPAN&gt; &lt;SPAN&gt;===&lt;/SPAN&gt; &lt;SPAN&gt;"finalproject/package.json"&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;textWriter&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;TextWriter&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;entry&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getData&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;textWriter&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;console&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"This is the content of the package.json file:"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;console&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;await&lt;/SPAN&gt; &lt;SPAN&gt;textWriter&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getData&lt;/SPAN&gt;&lt;SPAN&gt;());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Just adapt the filename check, and you should be able to extract the data you need.&lt;/P&gt;
&lt;P&gt;Also, remember that you don't have access to the file system within an app function, so everything you do needs to be in memory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this helps!&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 20 Nov 2023 07:50:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229228#M631</guid>
      <dc:creator>stefan_eggersto</dc:creator>
      <dc:date>2023-11-20T07:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Unzipping a file with newest DT capability</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229243#M632</link>
      <description>&lt;P&gt;On the function documentation I'm reading that there are few limitation.&lt;/P&gt;&lt;P&gt;I'm particular interest in this one:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Function inputs/outputs can't be larger than 5 MB, respectively.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Suppose the first API call will give me back a 15 MB .zip file, am I already breaching the current function limit?&lt;BR /&gt;&lt;BR /&gt;Thank for the previous reply, I appreciated it&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 08:52:48 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229243#M632</guid>
      <dc:creator>y_buccellato</dc:creator>
      <dc:date>2023-11-20T08:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Unzipping a file with newest DT capability</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229259#M633</link>
      <description>&lt;P&gt;The input refers to the payload you can send to the function, and the output is what you return from the function.&lt;/P&gt;
&lt;P&gt;A fetch request to an external service is not impacted by these limits.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 09:13:32 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229259#M633</guid>
      <dc:creator>stefan_eggersto</dc:creator>
      <dc:date>2023-11-20T09:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unzipping a file with newest DT capability</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229261#M634</link>
      <description>&lt;P&gt;Thank you very much - a lot of learning and nuance (also due to language barrier) for me.&lt;BR /&gt;&lt;BR /&gt;I'll do my best&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 09:15:34 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229261#M634</guid>
      <dc:creator>y_buccellato</dc:creator>
      <dc:date>2023-11-20T09:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unzipping a file with newest DT capability</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229478#M641</link>
      <description>&lt;P&gt;Is the javascript code you posted applicable in a workflow step?&lt;BR /&gt;&lt;BR /&gt;When I select a "Run Javascript" and paste/execute the code I have a reply back&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;An error occurred: {"code": 541, "message": "Execution crashed.", "details": {"type": "BAD_REQUEST", "message": "&amp;lt;stripped secret anyhow::Error&amp;gt;"}}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Which is leading me to think that I need use another approach.&lt;BR /&gt;&lt;BR /&gt;PS from work flow I'm able to download the first zip file but then I don't know how to reference the previous downloaded file to unzip it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 10:31:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229478#M641</guid>
      <dc:creator>y_buccellato</dc:creator>
      <dc:date>2023-11-21T10:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Unzipping a file with newest DT capability</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229494#M642</link>
      <description>&lt;P&gt;No, it won't work in a Workflow step. You currently can't use third-party libraries in Workflows.&lt;/P&gt;
&lt;P&gt;However, you can create an app with this logic in an app function, and then call it from a Workflow step.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 12:34:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229494#M642</guid>
      <dc:creator>stefan_eggersto</dc:creator>
      <dc:date>2023-11-21T12:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unzipping a file with newest DT capability</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229611#M646</link>
      <description>&lt;P&gt;Just an update to give you my impression: when I became aware that I didn't exactly get you the first time, I decided to start from scratch and followed the DT tutorial on some of the documentation page.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doing it this way I better understood the fundamentals and also where an app function must be placed to execute the logic (though I don't fully understand why should I create an entire app if I only need an app Function to execute some specific logic likely to be "Take some data, manipulate it, push some data to DT as logs").&lt;BR /&gt;In the end I think I managed to configure the first part of the logic which was to do a Get, retrieve a zip and unzip it - definitely also thanks to your original answer - but I think I will stop here and look for an alternative solution.&lt;BR /&gt;&lt;BR /&gt;In my prev. experience I was going with bash and recently I went with Power Automate and I thought I could find a similar friendly environment for my case. Here it appears I need to have a low to mid experience in the developing field which I can grow in time but I don't have immediately at my disposal.&lt;BR /&gt;For time and daily tasks reason I will put an hold on this but overall it was a good experience.&lt;BR /&gt;&lt;BR /&gt;Thank you for your help and time,&lt;BR /&gt;&lt;BR /&gt;regards&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 07:37:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Unzipping-a-file-with-newest-DT-capability/m-p/229611#M646</guid>
      <dc:creator>y_buccellato</dc:creator>
      <dc:date>2023-11-22T07:37:11Z</dc:date>
    </item>
  </channel>
</rss>

