Search In multidimensional array by keys value

// Array representing a possible record set returned from a database
$records = array(
    array(
        'id' => 2135,
        'first_name' => 'John',
        'last_name' => 'Doe',
    ),
    array(
        'id' => 3245,
        'first_name' => 'Sally',
        'last_name' => 'Smith',
    ),
    array(
        'id' => 5342,
        'first_name' => 'Jane',
        'last_name' => 'Jones',
    ),
    array(
        'id' => 5623,
        'first_name' => 'Peter',
        'last_name' => 'Doe',
    )
);
$id = array_search(5623, array_column($records, 'id'));
print_r($records[$id]);

Reference :

1) https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value
2) https://vijayasankarn.wordpress.com/2017/02/20/array_unique-for-multidimensional-array/

read and write into file using Piping in NodeJs

var fs = require('fs');

var stream = fs.createReadStream('data.json'),
writable = fs.createWriteStream('data_copy.json');

stream.pipe(process.stdout);

stream.pipe(writable);

Reading txt File in chunk in nodeJs using stream (updated : added pause and resume)

var fs = require('fs');

var stream = fs.createReadStream('data.json');


//stream.pause(); To pause the streaming
//stream.resume(); To resume the streaming


stream.on('data', function (chunk) {


console.log('-----------------START----------------');
console.log(chunk.toString());
console.log('----------------FINISH----------------');

});


stream.on('data', function (chunk) {

console.log('CHUNK LENGTH WAS: ' + chunk.length);

});

stream.on('end', function () {

console.log('----------------END OF THE FILE----------------');

});