Message from JavaScript discussions

September 2017

— I am writing that MMU, crazy stuff for JS

— 

All of it will run in Electron with Supervisor and User modes, along with their own memory spaces, seperated by an IPC socket through the kernel

— I might implement a bit-mapped graphics output... maybe

— Probably a fullscreen HTML5 canvas or something

— Wtf?

— Wouldn't it be better to implement that in any other language?

— I mean, I'm no expert, but that sounds like a bite too big for JS lol

— Hello everyone, please i just started learning js so i am going through a video by net ninja on node.js... but when i run this code to create a directory and also create a file write.txt in it containing the content from the read.txt file it is just not showing anything in the new directory i created.. What could have gone wrong???
var fs = require('fs');

fs.mkdirSync('stuff', function(){
fs.readFile('read.txt', 'utf8', function(err, data){
fs.writeFile('./stuff/write.txt', data);
});
});

Message permanent page

— Remove "Sync"?

— It worked thanks, totally did not see that

— Also look at util.promisify

— 

const fs =
require('fs');
const { promisify } =
require('util');

const mkdir =
promisify(fs.mkdir);
const readFile =
promisify(fs.readFile);
const writeFile =
promisify(fs.writeFile);

mkdir('stuff')
.then(() =>
readFile('read.txt'))
.then(data =>
writeFile('stuff/write.txt', data));

Message permanent page