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-07 02:55:14
how to write to a json file in javascript
'use strict'; const fs = require('fs'); let student = { name: 'Mike', age: 23, gender: 'Male', department: 'English', car: 'Honda' }; let data = JSON.stringify(student, null, 2); fs.writeFile('student-3.json', data, (err) =>... 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 2022-01-30 12:25:37
how to use json schema faker
import { schema } from './mockDataSchema'; import chalk from 'chalk'; const {resolve, extend} = require('json-schema-faker'); const fs = require('fs'); extend('faker', () => require('faker')); resolve(schema).then(sample => { console.log(... Add solution -
Javascript 2021-11-21 22:33:13
nodejs sharp change image to multiple sizes
// Sharp and FS module needed. ;(async function(){ let imgBuffer = await sharp("./myimage.jpg").toBuffer() let thumbnail = await sharp(imgBuffer).resize(100, 100).toBuffer() let image = await sharp(imgBuffer).resize(1600, 900).toBuffer(... Add solution -
TypeScript 2021-11-19 20:45:17
Write a Python program to create a file containing student records where each record contain rollno and marks in 3 subjects separated by a comma (marks to be considered as list of 3 values).
##Write a Python program to create a file of elements of any data type (mixed data type, i.e. some elements maybe of type int, some elements of type float and some elements of type string). Split this file into three file containing elements of same dat... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5