buff

Buff your node repl or runtime with the best libraries and utilities.

Buff

Quickly buff your Node environment with the best libraries and utilities when writing quick scripts or using the repl.

Inspired by Hoarders.

Install: npm install buff

Require in the repl or a file: require('buff')

Now you have access to all these goodies, predefined globally, no require() necessary:

All native node modules are pre-required for your convenience. Docs ex: fs.readFileSync('./file.txt')

lodash as _* or lodash - Utility library, successor to underscore.

  • The node repl takes control of _ for the last result so use lodash instead from the repl.

async - Flow control.

q - Promises Flow Control.

when - Promises.

open - Open the browser or file manager with the given URI. ex: open("http://www.google.com")

growl - Show Growl notification (or equivalent) with given message. You may need to sudo gem install terminal-notifier first. ex: growl("You have mail!")

moment - Date, time, and duration manipulation.

string as S - String manipulation. ex: S('-moz-something').camelize().s // 'mozSomething'

request - HTTP request library. ex: request.get({url: "http://some.com/file.json", json:true}, function (err, res, body) { })

express - Easily create HTTP Servers.

ecstatic - Easily serve a directory over HTTP. ex: http.createServer(ecstatic('./')).listen(8080)

mkdirp - mkdir -p, create all directories in given path. ex: mkdirp.sync("./some/new/folders")

mime - lookup mime types. ex: mime.lookup("/path/to/file.txt") // 'text/plain'

glob - Match files using patterns. ex: glob.sync("**/*.js")

wrench - Useful file system operations.

csv - Parse comma delimited strings. ex: csv().from.string('"1","2"\n"a","b"').to.array(function(data) { }) // data will be [[ '1', '2'], ['a', 'b']]

xml2json - Parse xml. ex: xml2json.toJson("<doc attr='val'><child>1</child><child>2</child></doc>") // {"doc":{"attr":"val","child":[1,2]}}

md5 - Md5 hash strings. ex: md5('message') // 78e731027d8fd50ed642340b7c9a63b3

cli-color as clc - Output colored text to your CLI. ex: clc.red('Text in red')

json-table as table - Print an array of objects as a table. ex: table([ {name: 'foo', age: 12}, {name: 'bar', age: 73} ])

eyes* - Pretty print Objects. ex: inspect({foo: "bar"})

  • inspect is an alias of eyes.inspect