socket.io-stream
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -23,7 +23,16 @@ var util = require('util'); | ||
options = options || {}; | ||
this.blob = blob; | ||
this.slice = blob.slice || blob.webkitSlice || blob.mozSlice; | ||
this.start = 0; | ||
this.sync = options.synchronous || false; | ||
var fileReader = this.fileReader = new FileReader(); | ||
var fileReader; | ||
if (options.synchronous) { | ||
fileReader = this.fileReader = new FileReaderSync(); | ||
} else { | ||
fileReader = this.fileReader = new FileReader(); | ||
} | ||
fileReader.onload = bind(this, '_onload'); | ||
@@ -39,7 +48,12 @@ fileReader.onerror = bind(this, '_onerror'); | ||
if (chunk.size) { | ||
this.fileReader.readAsArrayBuffer(chunk); | ||
if (this.sync) { | ||
var bufferChunk = new Buffer(new Uint8Array(this.fileReader.readAsArrayBuffer(chunk))); | ||
this.push(bufferChunk); | ||
} else { | ||
this.fileReader.readAsArrayBuffer(chunk); | ||
} | ||
} else { | ||
this.push(null); | ||
} | ||
}; | ||
} | ||
@@ -46,0 +60,0 @@ BlobReadStream.prototype._onload = function(e) { |
@@ -35,3 +35,3 @@ var util = require('util'); | ||
// represent a stream in an object. | ||
var v = { '$stream': stream.id }; | ||
var v = { $stream: stream.id }; | ||
if (stream.options) { | ||
@@ -73,3 +73,3 @@ v.options = stream.options; | ||
Decoder.prototype.decode = function(v) { | ||
if (v && v['$stream']) { | ||
if (v && v.$stream) { | ||
return this.decodeStream(v); | ||
@@ -86,3 +86,3 @@ } else if (util.isArray(v)) { | ||
var stream = new IOStream(obj.options); | ||
stream.id = obj['$stream']; | ||
stream.id = obj.$stream; | ||
this.emit('stream', stream); | ||
@@ -89,0 +89,0 @@ return stream; |
@@ -196,3 +196,3 @@ var util = require('util'); | ||
} else { | ||
this._error(id, 'invalid stream id'); | ||
debug('ignore invalid stream id'); | ||
} | ||
@@ -206,3 +206,3 @@ }; | ||
if (!stream) { | ||
this._error(id, 'invalid stream id'); | ||
callback('invalid stream id: ' + id); | ||
return; | ||
@@ -209,0 +209,0 @@ } |
{ | ||
"name": "socket.io-stream", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "stream for socket.io", | ||
@@ -29,3 +29,3 @@ "author": "Naoyuki Kanezawa <naoyuki.kanezawa@gmail.com>", | ||
"scripts": { | ||
"prepublish": "make build test", | ||
"prepublish": "make build", | ||
"test": "make test" | ||
@@ -35,14 +35,14 @@ }, | ||
"component-bind": "~1.0.0", | ||
"debug": "~2.1.3" | ||
"debug": "~2.2.0" | ||
}, | ||
"devDependencies": { | ||
"blob": "0.0.4", | ||
"browserify": "~9.0.8", | ||
"browserify": "~11.2.0", | ||
"expect.js": "~0.3.1", | ||
"mocha": "~2.2.4", | ||
"socket.io": "~1.3.5", | ||
"socket.io-client": "~1.3.4", | ||
"zuul": "~2.1.1", | ||
"mocha": "~2.3.3", | ||
"socket.io": "~1.3.7", | ||
"socket.io-client": "~1.3.7", | ||
"zuul": "~3.7.1", | ||
"zuul-ngrok": "~3.0.0" | ||
} | ||
} |
@@ -6,3 +6,3 @@ # Socket.IO stream | ||
This is the module for bidirectional binary data transfer with Stream API through [Socket.IO](https://github.com/LearnBoost/socket.io). | ||
This is the module for bidirectional binary data transfer with Stream API through [Socket.IO](https://github.com/socketio/socket.io). | ||
@@ -211,3 +211,3 @@ ## Installation | ||
Node Buffer class to use on browser, which is exposed for convenience. On Node environment, uou should just use normal `Buffer`. | ||
[Node Buffer](https://nodejs.org/api/buffer.html) class to use on browser, which is exposed for convenience. On Node environment, you should just use normal `Buffer`. | ||
@@ -214,0 +214,0 @@ ```js |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
201247
6197
7
+ Addeddebug@2.2.0(transitive)
+ Addedms@0.7.1(transitive)
- Removeddebug@2.1.3(transitive)
- Removedms@0.7.0(transitive)
Updateddebug@~2.2.0