javascript - Node.js Split large file into parts and iterate over the parts -


node.js running on linux. test files larger 100mb , split them chunks of 100mb. can use exec

// executes `split` child = exec("split -d -b 104857600k  $file_name", function (error, stdout, stderr) {   sys.print('stdout: ' + stdout);   sys.print('stderr: ' + stderr);   if (error !== null) {     console.log('exec error: ' + error);   } }); 

but how know how many parts generated , how can iterate on them?

you can enable --verbose print in stdout result files.

child = exec("split -d -b 104857600k --verbose $file_name", function (error, stdout,stderr) {   if (!error) {     // file names output      var resultfiles = stdout.match(/x(\d+)/g);   } else {     console.log('exec error: ' + error);   } });  

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -