// Create a Buffer from a string
const buffer = Buffer.from('Hello, Node.js!');
// Print the Buffer as a string
console.log('Buffer:', buffer.toString());Create and Print Buffer
javascript
Related Posts
More content you might like
Tutorial
Build a Custom Rate Limiter in Node.js with Redis
When developing web apps or APIs, it’s critical to prevent users from overwhelming your server. That’s where rate limiting comes in. In this guide, we’ll build a custom rate limiter in Node.js using Redis—no libraries, no magic, just code you control and understand.
- How to use Redis to count and throttle requests
- How to implement reusable middleware in Express
- How to rate limit by IP or API key
- Why this method is better for learning and customization
Apr 04, 2025
Read More Tutorial
javascript css +1
Building a Real-Time Chat Application with WebSockets in Node.js
const socket = io();
const messageForm = document.getElementById('chat-form');
const messageInput = document.getElementById('message');
const messagesList = document.getElementById('messages');
messageForm.addEventListener('submit', (e) => {
e.preventDefault();
const message = messageInput.value;
socket.emit('chatMessage', message);
messageInput.value = '';
});
socket.on('chatMessage', (message) => {
const li = document.createElement('li');
li.textContent = message;
messagesList.appendChild(li);
});node server.jsAug 03, 2024
Read More Code
php
JWT Token Creation and Verification in Node.js using 'jsonwebtoken'
No preview available for this content.
Jan 26, 2024
Read More Code
javascript
Simple HTTP Server in Node.js
No preview available for this content.
Jan 26, 2024
Read MoreDiscussion 0
Please sign in to join the discussion.
No comments yet. Be the first to share your thoughts!