<?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: Shivang Garg</title>
    <description>The latest articles on DEV Community by Shivang Garg (@shivang10).</description>
    <link>https://dev.to/shivang10</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%2F361931%2Fb7398ff5-f5eb-4b7d-933c-15e57de25d7c.png</url>
      <title>DEV Community: Shivang Garg</title>
      <link>https://dev.to/shivang10</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shivang10"/>
    <language>en</language>
    <item>
      <title>Asynchronous Reading of Directory and File in Node.js</title>
      <dc:creator>Shivang Garg</dc:creator>
      <pubDate>Sun, 26 Jul 2020 16:46:32 +0000</pubDate>
      <link>https://dev.to/shivang10/asynchronous-reading-of-directory-and-file-in-node-js-54fn</link>
      <guid>https://dev.to/shivang10/asynchronous-reading-of-directory-and-file-in-node-js-54fn</guid>
      <description>&lt;p&gt;Asynchronous programming in JavaScript certainly makes many operations easy to perform though initially, it is tough to get that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;fs.readdir&lt;/strong&gt; reads the content of the directory and &lt;strong&gt;fs.readFile&lt;/strong&gt; reads the content of the file asynchronously. So, here in this code, we will be reading the directory content and then the files in that directory in an asynchronous way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh819wwy5tpei6wvlbpd3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh819wwy5tpei6wvlbpd3.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we are first reading the directory, storing the content of the directory in &lt;strong&gt;fileNames&lt;/strong&gt; and as soon as directory traversing is done, we then start traversing the files of that directory. &lt;/p&gt;

&lt;p&gt;Each file is read and after that, the data of that file is pushed back into the dataset.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you find anything wrong or any other method for this, do mention in the comment section.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
