Today I Learned - Rocky Kev

Tagged “node”

  1. TIL what is npm Script

    Despite their high usage they are not particularly well optimized and add about 400ms of overhead. In this article we were able to bring that down to ~22ms.

  2. TIL keywords in package.json

    Today I learned what keywords are in a package.json file! It's a collection of keywords about a module. Keywords can help identify a package, related modules and software, and concepts.

  3. TIL outputting objects in Node

    In your Node projects -- sometimes you just need to output the object. Stringify it.

  4. TIL Libuv

    Libuv also implements two extremely important features of Nodejs which are the event loop and the thread pool and in simple terms, the event loop is responsible for handling easy tasks like executing callbacks and network I/O while the thread pool deals with heavy work like file access or compression.

  5. TIL node modules fs and os

    with fs - you can access files, read files, make directories, chmod. With os - get stats, machine, version, hosts.

  6. TIL Node Streams

    Imagine if you did some data-extensive fetch request getting a 1 gig file. 1 gig can take a while, and it's fetching it in memory.

  7. TIL Websockets

    They offer a long lived, bidirectional communication channel between client and server. Once established, the channel is kept open, offering a very fast connection with low latency and overhead.

  8. TIL Node.js Event Emitter

    This is kinda like the addEventListener() for browser javascript.

  9. TIL JS Cron and process.platform

    Cron is a tool that allows you to execute something on a schedule. This is typically done using the cron syntax. process.platform tells you what platform the user is running. For this usecase, if it's win32, use robocopy. Else use rsync.

  10. TIL NPM Christmas

    This cute binary from NPM lets you really kick off the holidays.

  11. TIL about why Node was invented

    Node.js applications never buffer data, which dramatically reduces the processing time of uploading files, such as videos or audios. In other words, it simply outputs data in chunks, meaning that, for example, a user can watch videos without any interruption.

  12. TIL Npx npm-check-updates

    Updating packages is frequent chore to do so you are always running the latest security patches.

  13. TIL npx

    This command allows you to run an arbitrary command from an npm package (either one installed locally, or fetched remotely), in a similar context as running it via npm run.

  14. TIL Web scraping with node

    Fetch the data, traverse the dom, and return the data.

  15. TIL how to create randomware in nodejs

    As a developer, it's important to know the power we have in our hands, and how to execute and defend against it/avoid it. Running randomware attacks is illegal.

  16. TIL the different Javascript Engines

    There's dozens of JS engines. V8 ,Chakra, Spidermonkey, JavascriptCore Webkit, JerryScript...

  17. TIL how Node/V8 works with imports/exports

    This is accurate only up to how JS works in Chrome-based browsers, and NodeJS, as Node uses V8 under the hood. But overall, it's referencing vs live binding

  18. TIL how to quickly create a .nvmrc file

    all you need is 'node -v > .nvmrc' and let the magic happen

  19. TIL how to append a date to a filename in Node

    My goal was to create a helper function that allows me to build a new file, and append a date to a filename for logging.

  20. TIL getting all files with an extension in Node using Glob

    This helper function to get all the files that end in a specific extension in node

  21. TIL unzipping a file in node using zlib

    Since my application needs to read whatever is inside that '.gz' file, I had to figure out a way to simplify that. That was done with zlib.

  22. TIL end all node processing scripts

    killall node - a sure fire way to kill a node.js server that won't stop running.

  23. TIL of a console.log way to avoid [object object]

    you can use JSON.stringify to get a object.

  24. TIL why NodeJS in reference to I/O

    Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. tl;dr: bypasses JavaScript single-threaded event loop

  25. TIL rimraf, a rm alternative

    rm is platform specific (and certainly will not work on Windows) and rimraf deals with this for us.

  26. TIL How to exit out of a node script

    If you write a node script, you can terminate it by Ctrl+C, or forcing a quit within the script, or using the process.exit()

  27. TIL about some key elements of NestJS

    Controllers, Providers, and Modules OH MY!

See all tags.