create file node javascript
var fs = require('fs');
fs.open('mynewfile2.txt', 'w', function (err,
file) {
if (err) throw err;
console.log('Saved!');
});
create file node javascript
var fs = require('fs');
fs.open('mynewfile2.txt', 'w', function (err,
file) {
if (err) throw err;
console.log('Saved!');
});
create file in nodejs
fs.writeFile('<fileName>',<contenet>, callbackFunction)
create file object node js
var imagePath = path.join('/images/logo.png', 'logo.png');
if (fs.statSync(imagePath)) {
var bitmap = fs.readFileSync(imagePath);
var bufferImage = new Buffer(bitmap);
Magic = mmm.Magic;
var magic = new Magic(mmm.MAGIC_MIME_TYPE);
magic.detectFile(imagePath, function(err, result) {
if (err) throw err;
datas = [{"buffer": bufferImage, "mimetype": result, "originalname": path.basename(imagePath)}];
var JsonDatas= JSON.parse(JSON.stringify(datas));
log.notice(JsonDatas);
});
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us