nyc-bookstores/node_modules/beefy/node_modules/filed/package.json

24 lines
2.9 KiB
JSON

{
"name": "filed",
"description": "Simplified file library.",
"version": "0.0.7",
"repository": {
"type": "git",
"url": "git://github.com/mikeal/filed.git"
},
"author": {
"name": "Mikeal Rogers",
"email": "mikeal.rogers@gmail.com"
},
"engines": {
"node": "*"
},
"scripts": {
"test": "node test/test.js"
},
"main": "./main",
"readme": "# filed -- Simplified file library.\n\n## Install\n\n<pre>\n npm install filed\n</pre>\n\n## Super simple to use\n\nFiled does a lazy stat call so you can actually open a file and begin writing to it and if the file isn't there it will just be created.\n\n```javascript\nvar filed = require('filed');\nvar f = filed('/newfile')\nf.write('test')\nf.end()\n```\n\n## Streaming\n\nThe returned file object is a stream so you can do standard stream stuff to it. Based on *what* you do the object it will be a read stream, a write stream.\n\nSo if you send data to it, it'll be a write stream.\n\n```javascript\nfs.createReadStream.pipe(filed('/newfile'))\n```\n\nIf you pipe it to a destination it'll be a read stream.\n\n```javascript\nfiled('/myfile').pipe(fs.createWriteStream('/out'))\n```\n\nAnd of course you can pipe a filed object from itself to itself and it'll figure it out.\n\n```javascript\nfiled('/myfile').pipe(filed('/newfile'))\n```\n\nThose familiar with [request](http://github.com/mikeal/request) will be familiar seeing object capability detection when doing HTTP. filed does this as well.\n\n```javascript\nhttp.createServer(function (req, resp) {\n filed('/data.json').pipe(resp)\n})\n```\n\nNot only does the JSON file get streamed to the HTTP Response it will include an Etag, Last-Modified, Content-Length, and a Content-Type header based on the filed extension.\n\n```javascript\nhttp.createServer(function (req, resp) {\n req.pipe(filed('/newfile')).pipe(resp)\n})\n```\n\nWhen accepting a PUT request data will be streamed to the file and a 201 status will be sent on the HTTP Response when the upload is finished.\n\nDuring a GET request a 404 Response will be sent if the file does not exist.\n\n```javascript\nhttp.createServer(function (req, resp) {\n req.pipe(filed('/data.json')).pipe(resp)\n})\n```\n\nThe Etag and Last-Modified headers filed creates are based solely on the stat() call so if you pipe a request to an existing file the cache control headers will be taken into account; a 304 response will be sent if the cache control headers match a new stat() call. This can be very helpful in avoiding unnecessary disc reads.\n\n```javascript\nhttp.createServer(function (req, resp) {\n req.pipe(filed('/directory')).pipe(resp)\n})\n```\n\nJust to round out the full feature set and make it full file server if you give filed an existing directory it will actually check for an index.html file in that directory and serve it if it exists.\n",
"_id": "filed@0.0.7",
"_from": "filed@0.0.7"
}