blob: c5e4397eb5ef9b65f82c65109482fe766955a952 [file] [log] [blame]
{
"name": "wrench",
"description": "Recursive filesystem (and other) operations that Node *should* have.",
"version": "1.4.4",
"author": {
"name": "Ryan McGrath",
"email": "ryan@venodesigns.net"
},
"repository": {
"type": "git",
"url": "https://ryanmcgrath@github.com/ryanmcgrath/wrench-js.git"
},
"bugs": {
"url": "http://github.com/ryanmcgrath/wrench-js/issues"
},
"directories": {
"lib": "./lib/"
},
"dependencies": {},
"devDependencies": {
"nodeunit": ">= 0.6.4"
},
"main": "./lib/wrench",
"engines": {
"node": ">=0.1.97"
},
"scripts": {
"test": "nodeunit tests/runner.js"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/ryanmcgrath/wrench-js/raw/master/LICENSE"
}
],
"readme": "wrench.js - Recursive file operations in Node.js\n----------------------------------------------------------------------------\nWhile I love Node.js, I've found myself missing some functions. Things like\nrecursively deleting/chmodding a directory (or even deep copying a directory),\nor even a basic line reader, shouldn't need to be re-invented time and time again.\n\nThat said, here's my attempt at a re-usable solution, at least until something\nmore formalized gets integrated into Node.js (*hint hint*). wrench.js is fairly simple\nto use - check out the documentation/examples below:\n\nInstallation\n-----------------------------------------------------------------------------\n\n npm install wrench\n\nUsage\n-----------------------------------------------------------------------------\n``` javascript\nvar wrench = require('wrench'),\n\tutil = require('util');\n```\n\n### Synchronous operations\n``` javascript\n// Recursively create directories, sub-trees and all.\nwrench.mkdirSyncRecursive(dir, 0777);\n\n// Recursively delete the entire sub-tree of a directory, then kill the directory\nwrench.rmdirSyncRecursive('my_directory_name', failSilently);\n\n// Recursively read directories contents.\nwrench.readdirSyncRecursive('my_directory_name');\n\n// Recursively chmod the entire sub-tree of a directory\nwrench.chmodSyncRecursive('my_directory_name', 0755);\n\n// Recursively chown the entire sub-tree of a directory\nwrench.chownSyncRecursive(\"directory\", uid, gid);\n\n// Deep-copy an existing directory\nwrench.copyDirSyncRecursive('directory_to_copy', 'location_where_copy_should_end_up');\n\n// Read lines in from a file until you hit the end\nvar f = new wrench.LineReader('x.txt');\nwhile(f.hasNextLine()) {\n\tutil.puts(x.getNextLine());\n}\n\n// Note: You will need to close that above line reader at some point, otherwise\n// you will run into a \"too many open files\" error. f.close() or fs.closeSync(f.fd) are\n// your friends, as only you know when it is safe to close.\n```\n\n### Asynchronous operations\n``` javascript\n// Recursively read directories contents\nvar files = [];\nwrench.readdirRecursive('my_directory_name', function(error, curFiles) {\n // curFiles is what you want\n});\n```\n\nQuestions, comments? Hit me up. (ryan [at] venodesigns.net | http://twitter.com/ryanmcgrath)\n",
"readmeFilename": "readme.md",
"_id": "wrench@1.4.4",
"_from": "wrench@1.4.4"
}