
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A command line script to load large sets of JSON data into a postgres database.
Install this globally and you'll have access to the loadjson command anywhere on your system.
$ npm install -g pg-json
or install it locally in your node_modules folder
$ npm install pg-json
$ loadjson [--FLAGS]
usage: loadjson [-h] [-v] --file ./data/<filename>.json [--database <dbname>]
[--user <username>] [--dbpassword <dbpassword>]
[--hostname <hostname>] [--port <port>]
[--maxclients <maxclients>] [--idle <idletimeout>]
A simple node script which takes a JSON file and populates a record for each
object within a postgres database.
Optional arguments:
-h, --help Show this help message and exit.
-v, --version Show program's version number and exit.
--file ./data/<filename>.json, -F ./data/<filename>.json
Provide JSON filename, omit extension, to be uploaded
to postgres database.
--database <dbname>, -D <dbname>
Provide a database name for the connection pool.
--user <username>, -U <username>
Provide a database user name for the connection pool.
--dbpassword <dbpassword>, -PW <dbpassword>
Provide a database user password for the connection
pool.
--hostname <hostname>, -H <hostname>
Provide a host name for the connection pool.
--port <port>, -P <port>
Provide a port number for the connection pool.
--maxclients <maxclients>, -M <maxclients>
Provide the maximum number of client connections for
the connection pool.
--idle <idletimeout>, -I <idletimeout>
Provide a maximum idle time for client connections
before being closed.
Program exits successfully if database records are created without Error. If
Error is present program exits failure.
The following action will be taken on this file: root/data/zips.json
[table_name]_id SERIAL PRIMARY KEYstring === SQL VARCHAR(256) OR TEXT (size restrictive)number (decimal) === SQL FLOATnumber === SQL INTEGERboolean === SQL BOOLEANobject === SQL TEXT (JSON stringified content)JSON file named zips.json
[
{ "city" : "AGAWAM", "loc" : [ -72.622739, 42.070206 ], "pop" : 15338, "state" : "MA", "zip" : "01001" },
{ "city" : "CUSHMAN", "loc" : [ -72.51564999999999, 42.377017 ], "pop" : 36963, "state" : "MA", "zip" : "01002" },
{ "city" : "BARRE", "loc" : [ -72.10835400000001, 42.409698 ], "pop" : 4546, "state" : "MA", "zip" : "01005" }
]
$ loadjson --file zips
$ psql
psql (9.5.4)
Type "help" for help.
user=# SELECT * FROM zips;
zips_id | city | loc | pop | state | zip
---------+---------+------------------------+-------+-------+-------
1 | AGAWAM | [-72.622739,42.070206] | 15338 | MA | 01001
2 | CUSHMAN | [-72.51565,42.377017] | 36963 | MA | 01002
3 | BARRE | [-72.108354,42.409698] | 4546 | MA | 01005
(3 rows)
FAQs
command line script to load JSON data into a postgres database
We found that pg-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.