Base64, Basic authentication header value with Node.js
Buffer.from(’login:password’).toString(’base64’); // bG9naW46cGFzc3dvcmQ=Buffer.from(‘login:password’).toString(‘base64’); // bG9naW46cGFzc3dvcmQ=
Buffer.from(’login:password’).toString(’base64’); // bG9naW46cGFzc3dvcmQ=Buffer.from(‘login:password’).toString(‘base64’); // bG9naW46cGFzc3dvcmQ=
const iv = Buffer.from(’aeghei1Di8tieNg0’); exports.encrypt = function(text, password){ try { var cipher = crypto.createCipheriv(’aes-128-cbc’,password,iv); var crypted = cipher.update(text,’utf8′,’hex’); crypted += cipher.final(’hex’); return crypted; } catch (err) { console.error(’encrypt error’,err); return null; } }; exports.decrypt = function(text, password){ try { var decipher = crypto.createDecipheriv(’aes-128-cbc’,password,iv); var dec = decipher.update(text,’hex’,’utf8’); dec += decipher.final(’utf8’); return dec; } Read more about AES-128 in js/Node.js[…]
require(’portscanner’).checkPortStatus( 80, ‘192.168.1.234’ , function(error, status) { console.log(status) })require(‘portscanner’).checkPortStatus( 80, ‘192.168.1.234’ , function(error, status) { console.log(status) })
{ "name": "node-sample-app", "version": "0.0.1", "private": true, "scripts": { "start": "node app.js" }, "dependencies": { "private-module1": "git+https://github.com/marioosh-net/private-module1", "private-module2": "git+ssh://github.com/marioosh-net/private-module2#master" } }{ "name": "node-sample-app", "version": "0.0.1", "private": true, "scripts": { "start": "node app.js" }, "dependencies": { "private-module1": "git+https://github.com/marioosh-net/private-module1", "private-module2": "git+ssh://github.com/marioosh-net/private-module2#master" } } more info here
Dependencies npm install socket.io Server var fs = require(’fs’); var app = require(’http’).createServer( function(req, res) { // serwuj client.html fs.readFile(’client.html’, function(err, data) { res.writeHead(200); res.end(data); }); } ); app.listen(8081); var io = require(’socket.io’).listen(app); io.sockets.on(’connection’, function (socket) { // send welcome message socket.emit(’from-server’, { date: ‘welcome to time service’ }); // send time on Read more about node.js – Socket.IO[…]