<?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: Abhishek Tripathi</title>
    <description>The latest articles on DEV Community by Abhishek Tripathi (@abhishektripathi66).</description>
    <link>https://dev.to/abhishektripathi66</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%2F1077688%2F7dfba6d2-3d7f-4ec9-8fb8-145f84a96212.jpeg</url>
      <title>DEV Community: Abhishek Tripathi</title>
      <link>https://dev.to/abhishektripathi66</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhishektripathi66"/>
    <language>en</language>
    <item>
      <title>Editing/Viewing the data of the File in angular</title>
      <dc:creator>Abhishek Tripathi</dc:creator>
      <pubDate>Tue, 06 Jun 2023 03:37:31 +0000</pubDate>
      <link>https://dev.to/abhishektripathi66/editingviewing-the-data-of-the-file-in-angular-5a60</link>
      <guid>https://dev.to/abhishektripathi66/editingviewing-the-data-of-the-file-in-angular-5a60</guid>
      <description>&lt;p&gt;Viewing the file in the angular. &lt;/p&gt;

&lt;p&gt;When we are listing the files in the angular using some transfer protocols like the sftp and ftp, sometimes there is even possibility that we want to see the data of that file. it’s a bit challenging work, but there is a library which would help us in this so that we can see the content of that file and along with that we can even edit it. &lt;br&gt;
The library I'm talking about is ngx-editor.&lt;br&gt;&lt;br&gt;
to install the ngx-editor and add it in to your project, &lt;a href="https://www.npmjs.com/package/ngx-editor"&gt;https://www.npmjs.com/package/ngx-editor&lt;/a&gt; this link can be visited. &lt;br&gt;
to add the ngx-editor post installing into the project add the below line in the app. module.ts&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { NgxEditorModule } from 'ngx-editor'; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;post this we need to fetch the data of the file which we want to read it and then decode it. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The ts file data&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_export class texteditor test implements OnInit { 

  editor!: Editor;  //a variable for the editor  
   
  html: string="&amp;lt;html&amp;gt;"; a string which contains the data, it is used to read and write the data 
  fileName:string=""; 
  constructor() 
{ 
      this.fileName=test”; 
    } 

  ngOnInit(): void { 
       
        var enc = new TextDecoder("utf-8"); //using a particular decoder 
        var arr = new Uint8Array([“filedata”]||[]); 
        this.html=enc.decode(arr);      // adding data to the html so it can be displayed 
     this.editor = new Editor(); // creating the instance of the editor 
      
  } 

  // make sure to destory the editor 
  ngOnDestroy(): void { 
    this.editor.destroy(); 
  } 
}_ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;The html file contains this data&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div id="main"&amp;gt; 
    
&amp;lt;ngx-editor-menu [editor]="editor" *ngIf="true"&amp;gt; &amp;lt;/ngx-editor-menu&amp;gt; // its used to display the menu of the editor which kind of has bold, italic, heading, images, link, adding colours to background and letters 
    
&amp;lt;ngx-editor [editor]="editor" [(ngModel)]="html" [disabled]="false"  &amp;gt;&amp;lt;/ngx-editor&amp;gt; // editor means which editor to be used, the ngModel is the data to be displayed or to be edited, if disabled is true then the data would not be editable and if its false then the data can be altered  

&amp;lt;/div&amp;gt; 

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;The box looks like how its shown below&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NuXr9kJe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/40a1239q5wpwm8jckcna.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NuXr9kJe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/40a1239q5wpwm8jckcna.png" alt="Image description" width="800" height="417"&gt;&lt;/a&gt;&lt;br&gt;
This is one of the way by which we can view the data which is present in the file, after editing the data the altered data is present in the ngModel variable. &lt;/p&gt;

</description>
      <category>angular</category>
      <category>ngxeditor</category>
      <category>viewing</category>
      <category>editing</category>
    </item>
    <item>
      <title>SFTP using the ssh2-sftp-client in Node JS</title>
      <dc:creator>Abhishek Tripathi</dc:creator>
      <pubDate>Sat, 06 May 2023 05:11:40 +0000</pubDate>
      <link>https://dev.to/abhishektripathi66/sftp-using-the-ssh2-sftp-client-in-node-js-2p48</link>
      <guid>https://dev.to/abhishektripathi66/sftp-using-the-ssh2-sftp-client-in-node-js-2p48</guid>
      <description>&lt;p&gt;Here we will be checking on how to get the files over the sftp, As there is alot of confusion on how to fetch the files in the required format, it can be a file path or a stream or just a Buffer.&lt;/p&gt;

&lt;p&gt;We would be using the &lt;a href="https://www.npmjs.com/package/ssh2-sftp-client#org252a716"&gt;ssh2-sftp-client&lt;/a&gt; library of the node js.&lt;/p&gt;

&lt;p&gt;There are two methods for getting the file and these methods are async in nature.&lt;/p&gt;

&lt;p&gt;**_- get(path, dst, options) ==&amp;gt; String|Stream|Buffer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fastGet(remotePath, localPath, options) ===&amp;gt; string_**&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let us go with the Get.&lt;br&gt;
Here if we are just giving the path of the file which needs to be fetched and not providing dst and the options then the output would be in the form of buffer, so if we want to transfer this buffer as a stream to the output then We would be adding this to the Readable stream. This readable stream can be piped to the response and can be sent out. This readable stream can also be added to the zip stream and that zip stream can be piped to response, if we want to zip the files before sending, this is useful if we are fetching multiple files.&lt;/p&gt;

&lt;p&gt;Along with the Path if we are giving the dst as the path which is the local path where the data needs to be saved into, then it automatically adds the data to the file. it doesnt give any call back if the dst is provided.&lt;br&gt;
if we are giving a stream for dst then it has to be a writestream and then that writestream can be piped to readstream and again here we can pipe it to response.&lt;/p&gt;

&lt;p&gt;If we are fetching only one file then we can directly pass in the response and the data is directly giving into response&lt;/p&gt;

&lt;p&gt;The fastget is useful when we are downloading single file and upon that we want to save it directly then we can just give the path.&lt;/p&gt;

&lt;p&gt;This is some basic details on the get. As many a times we tend to send the stream as response and saving of the file happens at different place and the fetching happens at another place so the local path is not aware, so for this purpose an stream has to be created without the file, for that purpose we would be passing in the buffer.&lt;/p&gt;

&lt;p&gt;This is my first technical post. Do let me know any suggestions if any.&lt;/p&gt;

</description>
      <category>node</category>
      <category>typescript</category>
      <category>ssh2sftpclient</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
