What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-22 00:37:06
js array from text file
const fs = require('fs') const makeArrayFromTextFile = (path) => { const text = fs.readFileSync(path, 'utf-8') const textByLine = text.split('\n') return textByLine } const array = makeArrayFromTextFile('./array.txt') console.log(array) // ['... Add solution -
Other 2021-10-18 14:22:05
error: error:0909006c:pem routines:get_name:no start line
You are probably using the wrong certificate file, what you need to do is generate a self signed certificate which can be done as follows openssl req -newkey rsa:2048 -new -nodes -keyout key.pem -out csr.pem openssl x509 -req -days 365 -in csr.pem -signk... Add solution -
Javascript 2021-10-16 15:55:07
file system replace line js
var fs = require('fs') fs.readFile(someFile, 'utf8', function (err,data) { if (err) { return console.log(err); } var result = data.replace(/string to be replaced/g, 'replacement'); fs.writeFile(someFile, result, 'utf8', function (err) { ... Add solution -
Javascript 2021-10-16 15:23:10
How to Upload Files to a Node.js Server
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=KP_8gN8kh4Y */ // Import dependencies const fs = require("fs"); const YAML = require("js-yaml"); const express = requi... Add solution -
Javascript 2021-10-12 13:28:02
read html file node js
const http = require("http"); //use fs module at first to read file const fs = require("fs"); const hostname = "127.0.0.1"; const port = 3000; // simple code to read file using fs module const files = fs.readFileSync("... Add solution
Best helpers
Ranking is empty