Get list of all npm packages

This downloads a 25MB JSON file

wget -O npmall1.json https://registry.npmjs.org/-/all
//prettify.js
var npmObject = require('./npmall.json')
var keys = Object.keys(npmObject)

var fs = require('fs')

var file = fs.createWriteStream('./npmall_pretty.json');

var count =0;
keys.forEach( (k) => {
	if ( count++ % 1000 === 0 ) console.log( count );
	var s = JSON.stringify( npmObject[ k ] )
	file.write( s + '\n' )
} )
file.end();
node --max_old_space_size=2000000 prettify.js
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s