Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated modules

  • Loading branch information...
commit a52bb1a0463901012cd6a83c3865ed7070a33fee 1 parent a1a7edd
Gabriel Llamas authored
4 test/tests/node_modules/buffered-writer/README.md
View
@@ -7,7 +7,7 @@ Node BufferedWriter
[Availability](#availability) | [Compatibility](#compatibility) | [Documentation](#documentation)
-Version: 0.1.9
+Version: 0.1.10
When you need to write a file you typically write the content in little chunks at a time. To avoid multiple calls to the underlying I/O layer you need to use a piece of memory called "buffer", so instead of writting directly to the disk, you write to the buffer and when it is filled the content is written to disk. Doing this you win performance.
@@ -38,5 +38,5 @@ Or simply copying `build/buffered-writer.js` into your project's directory and `
[Reference](https://github.com/Gagle/Node-BufferedWriter/wiki/Reference)
[Examples](https://github.com/Gagle/Node-BufferedWriter/tree/master/examples)
-[Change log](https://github.com/Gagle/Node-BufferedWriter/wiki/Change-log)
+[Change Log](https://github.com/Gagle/Node-BufferedWriter/wiki/Change-Log)
[MIT License](https://github.com/Gagle/Node-BufferedWriter/blob/master/LICENSE)
2  test/tests/node_modules/buffered-writer/buffered-writer.js
View
@@ -1 +1 @@
-"use strict";var EVENTS=require("events"),FS=require("fs"),BUFFER_SIZE=16384,EOL=process.platform.indexOf("win")!==-1?new Buffer([13,10]):new Buffer([10]),INVALID_BUFFER_SIZE=new Error("The buffer size must be greater than 0."),isArray=function(e){return Object.prototype.toString.call(e)==="[object Array]"},toHexArray=function(e){var t=[];do t.unshift(e&255),e>>>=8;while(e);return t},BufferedWriter=function(e,t){EVENTS.EventEmitter.call(this),t=t||{},t.bufferSize===0&&(t.bufferSize=-1),this._settings={bufferSize:t.bufferSize||BUFFER_SIZE,encoding:t.encoding||null,append:t.append?"a":"w"};if(this._settings.bufferSize<1)throw INVALID_BUFFER_SIZE;this._fileName=e,this._stream=null,this._buffer=null,this._bufferOffset=0};BufferedWriter.prototype=Object.create(EVENTS.EventEmitter.prototype),BufferedWriter.prototype.constructor=BufferedWriter,BufferedWriter.prototype._canWrite=function(e){return e+this._bufferOffset>this._settings.bufferSize&&(e=this._settings.bufferSize-this._bufferOffset),e},BufferedWriter.prototype._flush=function(){this._stream.write(new Buffer(this._bufferOffset!==this._settings.bufferSize?this._buffer.slice(0,this._bufferOffset):this._buffer)),this._bufferOffset=0},BufferedWriter.prototype._write=function(e,t,n){var r=this;this._buffer||(this._buffer=new Buffer(this._settings.bufferSize)),this.touch(r._settings.append);if(n===0)return;var i=this._canWrite(n);e.copy(this._buffer,this._bufferOffset,t,t+i),this._bufferOffset+=i,t+=i,n-=i,this._bufferOffset===this._settings.bufferSize&&(this._flush(),n!==0&&this._write(e,t,n))},BufferedWriter.prototype.close=function(e){if(!this._stream)return;this._bufferOffset!==0&&this._flush();var t=this;this._stream.on("close",function(){e&&e.call(this)}),this._stream.destroySoon(),this._stream=null,this._fd=null,this._buffer=null},BufferedWriter.prototype.newLine=function(){return this._write(EOL,0,EOL.length),this},BufferedWriter.prototype.touch=function(e){if(this._stream)return this;e=e||"w";var t=this;return this._stream=FS.createWriteStream(this._fileName,{flags:e,encoding:t._settings.encoding}).on("error",function(e){t.emit("error",e)}),this},BufferedWriter.prototype.write=function(e,t,n){var r=typeof e;if(r==="number")t=0,e=toHexArray(e),n=e.length,e=new Buffer(e);else if(r==="string")t=0,n=Buffer.byteLength(e,this._settings.encoding),e=new Buffer(e,this._settings.encoding);else{isArray(e)&&(e=new Buffer(e));var i=arguments.length;i===1&&(t=0,n=e.length==0?0:1)}return this._write(e,t,n),this},module.exports=BufferedWriter;
+"use strict";var EVENTS=require("events"),FS=require("fs"),Error=require("errno-codes");Error.create("INVALID_BUFFER_SIZE",Error.getNextAvailableErrorCode(),"The buffer size must be greater than 0.");var BUFFER_SIZE=16384,EOL=process.platform.indexOf("win")!==-1?new Buffer([13,10]):new Buffer([10]),toHexArray=function(e){var t=[];do t.unshift(e&255),e>>>=8;while(e);return t},BufferedWriter=function(e,t){EVENTS.EventEmitter.call(this),t=t||{},t.bufferSize===0&&(t.bufferSize=-1),this._settings={bufferSize:t.bufferSize||BUFFER_SIZE,encoding:t.encoding||null,append:t.append?"a":"w"};if(this._settings.bufferSize<1)throw Error.get(Error.INVALID_BUFFER_SIZE);this._fileName=e,this._stream=null,this._buffer=null,this._bufferOffset=0};BufferedWriter.prototype=Object.create(EVENTS.EventEmitter.prototype),BufferedWriter.prototype.constructor=BufferedWriter,BufferedWriter.prototype._canWrite=function(e){return e+this._bufferOffset>this._settings.bufferSize&&(e=this._settings.bufferSize-this._bufferOffset),e},BufferedWriter.prototype._flush=function(){this._stream.write(new Buffer(this._bufferOffset!==this._settings.bufferSize?this._buffer.slice(0,this._bufferOffset):this._buffer)),this._bufferOffset=0},BufferedWriter.prototype._write=function(e,t,n){var r=this;this._buffer||(this._buffer=new Buffer(this._settings.bufferSize)),this.touch(r._settings.append);if(n===0)return;var i=this._canWrite(n);e.copy(this._buffer,this._bufferOffset,t,t+i),this._bufferOffset+=i,t+=i,n-=i,this._bufferOffset===this._settings.bufferSize&&(this._flush(),n!==0&&this._write(e,t,n))},BufferedWriter.prototype.close=function(e){if(!this._stream)return;this._bufferOffset!==0&&this._flush();var t=this;this._stream.on("close",function(){e&&e.call(this)}),this._stream.destroySoon(),this._stream=null,this._fd=null,this._buffer=null},BufferedWriter.prototype.newLine=function(){return this._write(EOL,0,EOL.length),this},BufferedWriter.prototype.touch=function(e){if(this._stream)return this;e=e||"w";var t=this;return this._stream=FS.createWriteStream(this._fileName,{flags:e,encoding:t._settings.encoding}).on("error",function(e){t.emit("error",e)}),this},BufferedWriter.prototype.write=function(e,t,n){var r=typeof e;if(r==="number")t=0,e=toHexArray(e),n=e.length,e=new Buffer(e);else if(r==="string")t=0,n=Buffer.byteLength(e,this._settings.encoding),e=new Buffer(e,this._settings.encoding);else{Array.isArray(e)&&(e=new Buffer(e));var i=arguments.length;i===1&&(t=0,n=e.length==0?0:1)}return this._write(e,t,n),this},module.exports=BufferedWriter;
11 test/tests/node_modules/buffered-writer/package.json
View
@@ -1,6 +1,6 @@
{
"name": "buffered-writer",
- "version": "0.1.9",
+ "version": "0.1.10",
"description": "Fully configurable buffered writer.",
"keywords": [
"buffer",
@@ -30,7 +30,10 @@
}
],
"main": "buffered-writer",
- "readme": "<a name=\"start\"></a>\r\n\r\nNode BufferedWriter\r\n===================\r\n\r\n#### Fully configurable buffered writer for node.js ####\r\n\r\n[Availability](#availability) | [Compatibility](#compatibility) | [Documentation](#documentation)\r\n\r\nVersion: 0.1.9\r\n\r\nWhen you need to write a file you typically write the content in little chunks at a time. To avoid multiple calls to the underlying I/O layer you need to use a piece of memory called \"buffer\", so instead of writting directly to the disk, you write to the buffer and when it is filled the content is written to disk. Doing this you win performance.\r\n\r\nThis library allows you to write files using internal buffers, so you don't have to worry about them.\r\n\r\n<a name=\"availability\"></a>\r\n#### Availability [↑](#start) ####\r\n\r\nVia npm:\r\n\r\n```\r\nnpm install buffered-writer\r\n```\r\n\r\nOr simply copying `build/buffered-writer.js` into your project's directory and `require()` accordingly.\r\n\r\n***\r\n\r\n<a name=\"compatibility\"></a>\r\n#### Compatibility [↑](#start) ####\r\n\r\n✔ Node 0.4.10+\r\n\r\n***\r\n\r\n<a name=\"documentation\"></a>\r\n#### Documentation [↑](#start) ####\r\n \r\n[Reference](https://github.com/Gagle/Node-BufferedWriter/wiki/Reference) \r\n[Examples](https://github.com/Gagle/Node-BufferedWriter/tree/master/examples) \r\n[Change log](https://github.com/Gagle/Node-BufferedWriter/wiki/Change-log) \r\n[MIT License](https://github.com/Gagle/Node-BufferedWriter/blob/master/LICENSE)",
- "_id": "buffered-writer@0.1.9",
- "_from": "buffered-writer"
+ "readme": "<a name=\"start\"></a>\r\n\r\nNode BufferedWriter\r\n===================\r\n\r\n#### Fully configurable buffered writer for node.js ####\r\n\r\n[Availability](#availability) | [Compatibility](#compatibility) | [Documentation](#documentation)\r\n\r\nVersion: 0.1.10\r\n\r\nWhen you need to write a file you typically write the content in little chunks at a time. To avoid multiple calls to the underlying I/O layer you need to use a piece of memory called \"buffer\", so instead of writting directly to the disk, you write to the buffer and when it is filled the content is written to disk. Doing this you win performance.\r\n\r\nThis library allows you to write files using internal buffers, so you don't have to worry about them.\r\n\r\n<a name=\"availability\"></a>\r\n#### Availability [↑](#start) ####\r\n\r\nVia npm:\r\n\r\n```\r\nnpm install buffered-writer\r\n```\r\n\r\nOr simply copying `build/buffered-writer.js` into your project's directory and `require()` accordingly.\r\n\r\n***\r\n\r\n<a name=\"compatibility\"></a>\r\n#### Compatibility [↑](#start) ####\r\n\r\n✔ Node 0.4.10+\r\n\r\n***\r\n\r\n<a name=\"documentation\"></a>\r\n#### Documentation [↑](#start) ####\r\n \r\n[Reference](https://github.com/Gagle/Node-BufferedWriter/wiki/Reference) \r\n[Examples](https://github.com/Gagle/Node-BufferedWriter/tree/master/examples) \r\n[Change Log](https://github.com/Gagle/Node-BufferedWriter/wiki/Change-Log) \r\n[MIT License](https://github.com/Gagle/Node-BufferedWriter/blob/master/LICENSE)",
+ "_id": "buffered-writer@0.1.10",
+ "dist": {
+ "shasum": "b6f20f6bc147bfaee20d45ed06a5ce3f0603d800"
+ },
+ "_from": "buffered-writer@0.1.10"
}
Please sign in to comment.
Something went wrong with that request. Please try again.