buff
v1.0.0
Published
Buff your node repl or runtime with the best libraries and utilities.
Downloads
25
Readme
Buff
Quickly buff your Node environment with the best libraries and utilities when writing quick scripts or using the repl.
Inspired by Hoarders.
Usage
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:
Native Node Modules
All native node modules are pre-required for your convenience. Docs ex: fs.readFileSync('./file.txt')
General Utilities
lodash as _* or lodash - Utility library, successor to underscore.
- The node repl takes control of
_
for the last result so uselodash
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'
HTTP
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)
File System
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.
Formats
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
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