{"_id":"file-save","_rev":"373604","name":"file-save","description":"auto create path and just save the file!","dist-tags":{"latest":"0.2.0"},"maintainers":[{"name":"chilijung","email":"chilijung@gmail.com"}],"time":{"modified":"2021-07-29T06:06:57.000Z","created":"2014-02-15T04:09:24.869Z","0.2.0":"2014-07-08T03:17:54.147Z","0.1.1":"2014-02-16T05:05:49.611Z","0.1.0":"2014-02-15T04:09:24.869Z"},"users":{},"author":{"name":"chilijung","email":"chilijung@gmail.com","url":"http://lijung.com/"},"repository":{"type":"git","url":"git@github.com:chilijung/file-save.git"},"versions":{"0.2.0":{"name":"file-save","version":"0.2.0","description":"auto create path and just save the file!","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git@github.com:chilijung/file-save.git"},"keywords":["file","save"],"author":{"name":"chilijung","email":"chilijung@gmail.com","url":"http://lijung.com/"},"license":"MIT","bugs":{"url":"https://github.com/chilijung/file-save/issues"},"homepage":"https://github.com/chilijung/file-save","dependencies":{"mkdirp":"~0.5.0"},"devDependencies":{"mocha":"~1.17.1","should":"~3.1.2"},"_id":"file-save@0.2.0","dist":{"shasum":"39b20d0214e656b1417faa3c32d317b678545db7","size":1876,"noattachment":false,"key":"/file-save/-/file-save-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-save/download/file-save-0.2.0.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"chilijung","email":"chilijung@gmail.com"},"maintainers":[{"name":"chilijung","email":"chilijung@gmail.com"}],"directories":{},"publish_time":1404789474147,"_cnpm_publish_time":1404789474147,"_hasShrinkwrap":false},"0.1.1":{"name":"file-save","version":"0.1.1","description":"auto create path and just save the file!","main":"index.js","scripts":{"test":"./node_modules/.bin/mocha"},"repository":{"type":"git","url":"git@github.com:chilijung/file-save.git"},"keywords":["file","save"],"author":{"name":"chilijung","email":"chilijung@gmail.com","url":"http://lijung.com/"},"license":"MIT","bugs":{"url":"https://github.com/chilijung/file-save/issues"},"homepage":"https://github.com/chilijung/file-save","dependencies":{"mkdirp":"~0.3.5"},"devDependencies":{"mocha":"~1.17.1","should":"~3.1.2"},"_id":"file-save@0.1.1","dist":{"shasum":"a0fc9bbc95cf94996353b2c2363273b87d693903","size":1531,"noattachment":false,"key":"/file-save/-/file-save-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-save/download/file-save-0.1.1.tgz"},"_from":"./","_npmVersion":"1.3.17","_npmUser":{"name":"chilijung","email":"chilijung@gmail.com"},"maintainers":[{"name":"chilijung","email":"chilijung@gmail.com"}],"directories":{},"publish_time":1392527149611,"_cnpm_publish_time":1392527149611,"_hasShrinkwrap":false},"0.1.0":{"name":"file-save","version":"0.1.0","description":"auto create path and just save the file!","main":"index.js","scripts":{"test":"./node_modules/.bin/mocha"},"repository":{"type":"git","url":"git@github.com:chilijung/file-save.git"},"keywords":["file","save"],"author":{"name":"chilijung","email":"chilijung@gmail.com","url":"http://lijung.com/"},"license":"MIT","bugs":{"url":"https://github.com/chilijung/file-save/issues"},"homepage":"https://github.com/chilijung/file-save","dependencies":{"mkdirp":"~0.3.5"},"devDependencies":{"mocha":"~1.17.1","should":"~3.1.2"},"_id":"file-save@0.1.0","dist":{"shasum":"ecd9b96000f8907ecfe838fc72fafe459f072bda","size":1340,"noattachment":false,"key":"/file-save/-/file-save-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/file-save/download/file-save-0.1.0.tgz"},"_from":"./","_npmVersion":"1.3.17","_npmUser":{"name":"chilijung","email":"chilijung@gmail.com"},"maintainers":[{"name":"chilijung","email":"chilijung@gmail.com"}],"directories":{},"publish_time":1392437364869,"_cnpm_publish_time":1392437364869,"_hasShrinkwrap":false}},"readme":"# Streaming saving file\n\n[![Build Status](https://travis-ci.org/chilijung/file-save.png)](https://travis-ci.org/chilijung/file-save)\n\nStreaming data to file and save it using Stream.(the module will make directory itself if the directory is not exist).\n\n## Install\n\n```\nnpm install file-save\n```\n\n## Example\n\n```javascript\nvar fileSave = require('file-save');\n\n// the first line will create a writeStream to the file path\nfileSave('sample/test')\n    .write('this is the first line', 'utf8')\n    .write('this is the second line', 'utf8', function() {\n        console.log('writer callback')\n    })\n    .end('this is the end')\n    .error(function() {\n        console.log('error goes here')\n    })\n    .finish(function() {\n        console.log('write finished.')\n    })\n```\n\n## Usage\n\n```\nfileSave(<filename>)\n```\n\n`file-save` module will build a write stream to the file, and automatically make directory if the directory is not exist and need to create.\n\n## Chaining methods\n\n#### .write(chunk, [encoding], [callbak])\n\n- chunk (string)\n- encoding (string): like the encoding settings in writeable stream. http://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback \n- callback (function): callback function settings in writeable http://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback\n\n#### .end([string], [encoding], [callback])\n\nSame as `.write` method, but string is also optional.\n\n#### .error(callback)\n\nYou can make a callback, while the stream prompt error\n\nsee more: http://nodejs.org/api/stream.html#stream_event_error_1\n\n#### .finish(callback)\n\nMake a callback while finished, **using this method you have to call ** `.foot` **before calling this method**\n\nsee more: http://nodejs.org/api/stream.html#stream_event_finish\n\n## License\n\nMIT [@chilijung](http://github.com/chilijung)\n","_attachments":{},"homepage":"https://github.com/chilijung/file-save","bugs":{"url":"https://github.com/chilijung/file-save/issues"},"license":"MIT"}