Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/proxy_server/node_modules/country-data/data/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
// Take the csv files and convert them to standard format
var path = require('path');
var _ = require('underscore');
var csv = require('csv');
var fs = require('fs');
var firstHeader = process.argv[2];
var output = [];
// read in the CSV
var input = process.stdin;
var parser = csv.parse({"columns": true});
parser.on('readable', function () {
var record = null;
while(record = parser.read()){
output.push(record);
}
});
parser.on('finish', function(){
output = _.sortBy(output, function (i) { return i[firstHeader].toLowerCase();} );
var headers = _.keys(output[0]);
var remaining = _.without(headers, firstHeader);
var columns = _.flatten([firstHeader, remaining.sort()]);
// console.warn(columns);
csv.stringify(
output,
{ "header":true, "columns": columns },
function(err, string){ process.stdout.write(string) }
);
});
input.pipe(parser);
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0219 ]-- |