![]() I then end up with a buffer that is three bytes long with th string, and encoding that I used. Here I am using the Buffer from method as a way to create a new buffer from a hex encoded string. 1 - Basic example of the nodejs Buffer Slice methodįirst off how about a basic example of the buffer slice method. However in the process of doing so I guess I might also want to go over a few more examples of the write method when it comes to mutating a buffer in place, and other ways to go about creating a new buffer from a buffer. So in this post I will be going over a few quick examples of the Buffer slice method. ![]() ![]() When it comes to the write method that is what can be used to mutate a buffer in place, much like that of the Array splice method. When looking at the nodejs docs it would seem that there is no such method in the Buffer class, however there is the Buffer write method. There is however the array splice method that will mutate the array in place, so then the question might arise as to how to go about doing that with a buffer in nodejs. The slice method is often what I would use when it comes to creating a sub array from an array because of the nature of not mutating the array in place. When it comes to working with buffers in nodejs there is the nodejs buffer slice method that works more or less just like the Array slice method that will create a new array from an array without mutating the source array.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |