[HN Gopher] Working with the File System on Node.js
       ___________________________________________________________________
        
       Working with the File System on Node.js
        
       Author : ingve
       Score  : 18 points
       Date   : 2022-06-28 09:10 UTC (1 days ago)
        
 (HTM) web link (2ality.com)
 (TXT) w3m dump (2ality.com)
        
       | mcraiha wrote:
       | I remember a project that someone had created earlier. It had
       | custom prebuild step that replaced some values in .js files to
       | make dev/stage/prod selection. You had to run it twice to be
       | almost sure it worked. It was using fs.readFile without waiting
       | for a callback.
        
         | softfalcon wrote:
         | > It was using fs.readFile without waiting for a callback.
         | 
         | This is why I always use fs.readFileSync or correctly implement
         | the callback and read it sequentially myself as it feeds me
         | chunks of the file data buffer via the callback.
         | 
         | You can also use TypeScript and await on the promise which is
         | super clean, highly recommend it.
         | 
         | All in all, node's file system libs are pretty solid.
        
           | rantallion wrote:
           | > You can also use TypeScript and await on the promise
           | 
           | I'm not sure what you mean here. The promises and async/await
           | syntax come from JavaScript, not from TypeScript - TS is just
           | the sugar on top that provides the typings.
        
       ___________________________________________________________________
       (page generated 2022-06-29 23:02 UTC)