Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

nodjs : Stream for big file

// Use stream: for big file

const fs = require('fs');

const readStream = fs.createReadStream('./doc/custom_button.dart', {encoding: 'utf-8'});    // Create:  createReadStream()
const writeStream = fs.createWriteStream('./doc/get_code.dart')             // Create  createWriteStream()

        // Method 1

// readStream.on('data', (chunkData) => {
//     console.log('----- NEW CHUNK -----');
//     console.log(chunkData);

//     // add code to new file
//     writeStream.write(chunkData);       // Write code
    
// });

        // Method 2:  Use  Pipe for jon method : read and write
readStream.pipe(writeStream);

Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery v3.3.1 download 
Javascript :: pyautogui javascript 
Javascript :: javascript get days difference between two dates 
Javascript :: How to add pop-up confirmation in angular typescript. 
Javascript :: get data notifacation realtime use ajax good 
Javascript :: nodejs: express, morgan, mongoose package 
Javascript :: javascript template string condtioning 
Javascript :: window alert javascript css 
Javascript :: regex tunisian phone number 
Javascript :: phaser place on ellipse 
Javascript :: phaser add frames to existing animation 
Javascript :: phaser pause animation instances 
Javascript :: closre in js 
Javascript :: Six escape sequences are valid in JavaScript 
Javascript :: Datatable js Search Server side after time or word length 
Javascript :: nodejs mongodb native reuse single connection 
Javascript :: spiral traversal clockwise direction js 
Javascript :: Adding A Function To All Node Example With Javascript 
Javascript :: what is computed property in vue js 
Javascript :: regex capture group example 
Javascript :: module.exports equivalent typescript 
Javascript :: map method in javascript 
Javascript :: asp net core use newtonsoft json 
Javascript :: how to change class by is in js by toggle 
Javascript :: angular set timezone 
Javascript :: what are the comparison operators in javascript 
Javascript :: javascript remove an element from an array 
Javascript :: Working of Recursion in C++ 
Javascript :: rest operator in javascript 
Javascript :: mdn javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =