What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-27 16:25:36
Working with BSON in JavaScript
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=6pBWBNxzCUk */ // Import dependencies const fs = require("fs"); const BSON = require("bson"); // Serialize a document... Add solution -
Javascript 2022-03-03 23:15:28
nodejs array write to lines file
let arr = ["a", "b", "c", "d", "e", "f"]; console.log(arr); // [ 'a', 'b', 'c', 'd', 'e', 'f' ] console.log(arr.join('\n')); // a // b // c // d // e // f let text = arr.join('\n'); fs.writeF... Add solution -
Javascript 2022-02-16 15:00:06
javascript create text file
const fs = require('fs'); fs.writeFile("/tmp/test", "Hey there!", function(err) { if(err) { return console.log(err); } console.log("The file was saved!"); }); // Or fs.writeFileSync('/tmp/test-sync', 'H... Add solution -
Javascript 2022-01-31 03:57:19
Manually Parsing Plain text in Node.js
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=fy2RF9JR1BI */ // Import dependencies const fs = require("fs"); // Read the text file and split it on new lines const lines = f... Add solution -
Javascript 2021-11-17 22:26:08
puppeteer open browser authentication facebook
if (!Object.keys(cookies).length) {await page.goto("https://www.facebook.com/login", { waitUntil: "networkidle2" });await page.type("#email", config.username, { delay: 30 })await page.type("#pass", config.password, ... Add solution -
Javascript 2021-11-10 21:51:11
Generate PDFs From HTML & CSS with Node.js using Puppeteer
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=wQEeFaqVQgw */ // Import dependencies const puppeteer = require("puppeteer"); const fs = require("fs"); (async () =&g... Add solution -
Javascript 2021-11-05 03:23:10
Manually Parsing HTML in Node.js
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=PozG7Sva270 */ // Import dependencies const fs = require("fs"); const cheerio = require("cheerio"); const cheerioTable... Add solution -
TypeScript 2021-11-04 20:34:10
copy text from file to another file in javascript with fs
'use strict'; import fs from 'fs'; let fileContent = 'Anything what you want'; let message = fs.writeFileSync('message.txt', fileContent); function copyContent(fileName: string, dest: string): boolean { try { fs.copyFileSync(fileName, dest); ... Add solution