Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including npm-search with all npm packages installed. Try it out:

npm-search lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("npm-search/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

npm-search v0.0.1

npm-search

An index of npm using levelup.

installation

#download all the json in npm (~350 mb in feb 2013)
./dl-npm-json.sh

#initialize db
node index.js

node search.js physic~ vox~
=>
{ 'voxel-control': [ [ 'PHYSICAL', 3 ], [ 'VOXEL', 5 ] ],
  'voxel-physical': [ [ 'PHYSICAL', 1 ], [ 'VOXEL', 1 ] ],
  'player-physics': [ [ 'PHYSICS', 6 ], [ 'VOXEL', 2 ], [ 'VOXELJS', 2 ] ],
  'voxel-player': [ [ 'PHYSICS', 2 ], [ 'VOXEL', 9 ], [ 'VOXELPLAYER', 2 ] ] }

Queries like that will take 200ms to 1000ms, most of this time is spent opening the database.

If you want it to go really fast, open a server, and then request to it.

node search.js --port 9876 &

# search terms seperated by /
curl localhost:9876/search/terms

If you end a search term with ~ then it will return everthing that matches that prefix.

node search.js stream~ err~

todo

This is currently just a bunch of scripts. Will polish this to make it a propper tool.

license

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free