Node is buffer native method basics and more

The node is buffer method is the standard way to find out if something is a buffer or not in a nodejs project, when it comes to working with buffers in nodejs. The standard is buffer method is right there as part of the Buffer global, and can be used by just passing a value as the first argument. The resulting value that the node is buffer method will return is then a boolean value that will be true if the value is a Buffer, or not if it is not a buffer.

In addition there is also the is-buffer npm package as well, which is a user space option for this kind of task. One might thing that there is no need for such a package, but oddly enough there are often some extending situations in which there might actually need to be some additional logic, or the same task needs to be done a different way.

One might think that a task such as this would be a trivial matter, and in most cases it is, but in other cases it is not. There is a long history of having to make user space solutions for native methods in javaScript, such is the case with the native isNaN method returning true for values other than NaN. So lets take a look at this one real quick to find out if this is the case with the is Buffer method in nodejs..

Read More

A node cli tool text to hex example

So for todays post a node cli tool example from my on my node_cli_tools project I will be writing about a quick tool that I put together that can be used to convert a plain text file to a hex format. This kind of tool might come in handy when it comes to creating a collection of content that I want to store in a format that is not necessary encrypted, but is just in a format that is not human readable. The main use case is that I just want a simple tool that will convert markdown files for example into a format that just makes it so the content is not indexed by Google bot, but can easily be converted back to a plain text format.

Read More

A node cli tools text editor project

So when it comes to developing a node cli tool that is a text editor of sorts there are two general ideas that come to mind. One idea is a text editor that is terminal based in which I am using ansi escape codes to make a text editor like that of nano or vim. The other idea is a text editor that works in a browser window, and I am using nodejs as a way to serve a client system that is that editor, and also have some back end code that is used to save the file I am working on.

Read More

A node cli tools project

One of the great things about node.js is that it can be used as a way to create node cli tools using javaScript. A node cli tool can be used to create just about any kind of command line interface type application when it comes to general programing style tasks at least. Typically applications might be projects that are static site generators, and projects that involving walking the contents of a file system. However nodejs can be used to create a wide range of command line interface projects, as well as host a server that can be used to do all kinds of things in a browser window.

So this post is a general overview of my node cli tools project, that is a collection of nodejs powered command line interface tools. The main idea of this project is to just have a collection of node cli tools to write about for the sake of new content for my site here. However the tools also follow a general theme of creating tools that help with the process of creating and maintaining one ore more simple static websites.

Read More

A node cli project static site generator

So for todays node cli project I started working on a basic static site generator, one of many project ides of node cli tool examples. The project makes use of the npm package known as marked which can be used to parse markdown files into html, as well as some of my other node cli projects such as nc-walk that make part of my node cli tools repository project. This static site generator might not really be of production quality as of yet, but if I do put more time into this project I am sure it will get there.

Read More