<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Fei Liu on Medium]]></title>
        <description><![CDATA[Stories by Fei Liu on Medium]]></description>
        <link>https://medium.com/@liu.feiwood?source=rss-5e9c9326b8c7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*m6cHKjBikqRiMxeE.</url>
            <title>Stories by Fei Liu on Medium</title>
            <link>https://medium.com/@liu.feiwood?source=rss-5e9c9326b8c7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 00:04:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@liu.feiwood/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Replacing nvm with fnm]]></title>
            <link>https://medium.com/@liu.feiwood/replacing-nvm-with-fnm-dbd1a5a7b19?source=rss-5e9c9326b8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbd1a5a7b19</guid>
            <category><![CDATA[fnm]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[nvm]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Fei Liu]]></dc:creator>
            <pubDate>Sun, 10 Nov 2019 11:12:50 GMT</pubDate>
            <atom:updated>2020-01-17T08:21:33.360Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automatical version switch based on nvm (using fnm)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h31soI7FNh-Z70QQ" /><figcaption>Photo by <a href="https://unsplash.com/@marcsm?utm_source=medium&amp;utm_medium=referral">Marc Sendra Martorell</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>TL;DR Start using fnm instead of nvm will save you ~500 ms of waiting every time you start a new Terminal session. And with the help of a small script you can automatically switch thenode version among projects if there is a .nvmrc file present.</p><ul><li>fnm: <a href="https://github.com/Schniz/fnm">https://github.com/Schniz/fnm</a></li><li>auto switch script: <a href="https://gist.github.com/geastwood/14ccb700840a8b8a8538113eb6d76072">https://gist.github.com/geastwood/14ccb700840a8b8a8538113eb6d76072</a></li></ul><p>First of all, nvm is a great tool for helping developers to manage different node environments. I have been using nvm for years and quite happy about it. It came to my attention only when I start digging why it takes over <strong>1 whole second </strong>to start a new Terminal session.</p><p>After commenting line by line in my ~/.zshrc file, I found out the scripts related to nvm is actually the one to blame. The following two lines took <strong>500ms</strong> to run (check them in your ~/.zshrc file).</p><pre># Lines in ~/.zshrc<br>[ -s &quot;/usr/local/opt/nvm/nvm.sh&quot; ] &amp;&amp; . &quot;/usr/local/opt/nvm/nvm.sh&quot;  # This loads nvm<br>[ -s &quot;/usr/local/opt/nvm/etc/bash_completion&quot; ] &amp;&amp; . &quot;/usr/local/opt/nvm/etc/bash_completion&quot;  # This loads nvm bas</pre><h3>Now in search of a FIX</h3><p>The simplest approach is just to disable nvm all together and start loading it on the base of necessity. Well, this is just less optimal since the majority of my programming time is spend in an node environment. Having the ability to automatically switch the project’s node binary version is kinda handy.</p><p>The next logical step is too somehow lazy load the nvm based on some conditions, such as in a node project, and there is a .nvmrc file present. There are actually solutions on the internet just aiming in that direction, however it is to me too much like a hack with bloated bash script that not that much readable.</p><p>So here comes my current solution. To use a nvm alternative that is just <strong>faster. </strong>That is the fnm (<a href="https://github.com/Schniz/fnm">https://github.com/Schniz/fnm</a>). It’s quite an interesting read (<a href="https://hackernoon.com/fnm-fast-and-simple-node-js-version-manager-df82c37d4e87">https://hackernoon.com/fnm-fast-and-simple-node-js-version-manager-df82c37d4e87</a>) on how the author came to writing this tool and it also explains some internals of the project.</p><p>It’s almost a drop-in replacement of nvm, but I do have a script automatically switching node version based on .nvmrc, so some adaption is required. Below is the working version.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab1a28bf75a0967c3b639f6b4dc173a5/href">https://medium.com/media/ab1a28bf75a0967c3b639f6b4dc173a5/href</a></iframe><p>That’s all for it. If you have any suggestion/comment, just me a message.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbd1a5a7b19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ultra quick intro on how to use IPFS]]></title>
            <link>https://medium.com/@liu.feiwood/ultra-quick-intro-on-how-to-use-ipfs-f744a2757e2b?source=rss-5e9c9326b8c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f744a2757e2b</guid>
            <category><![CDATA[ipfs]]></category>
            <dc:creator><![CDATA[Fei Liu]]></dc:creator>
            <pubDate>Wed, 12 Sep 2018 13:48:34 GMT</pubDate>
            <atom:updated>2018-09-12T19:32:45.770Z</atom:updated>
            <content:encoded><![CDATA[<h4>Have you node running</h4><p>Follow the tutorial of how to install IPFS (<a href="https://docs.ipfs.io/introduction/install/">https://docs.ipfs.io/introduction/install/</a>). In my case, I have setup one node on cloud server and one locally on my Mac.</p><h4>Add data to IPFS</h4><p>Use the command ipfs add /path/to/your/file, if successful, you will receive a cid (content ID), using which to get the content from another node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pLYjXfN3b7MfrGWK44McUw.png" /><figcaption>Add data to IPFS</figcaption></figure><h4>Retrieve data from IPFS</h4><ol><li>Either run curl <a href="https://ipfs.io/ipfs/Qm...">https://ipfs.io/ipfs/Qm...</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vuZ84QNH69krLbwoYy3vxg.png" /><figcaption>Get data through ipfs.io</figcaption></figure><p>2. Or you can run inside a node, ipfs cat /ipfs/Qm...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IWE7sS7h3cf5gIPyUoqpDg.png" /><figcaption>Get data in an ipfs node</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f744a2757e2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>