fs-stream-websocket
Advanced tools
Comparing version 0.1.0 to 0.1.1
12
fs.js
var path = require('path'); | ||
var querystring = require('querystring'); | ||
var websocket = require('websocket-stream'); | ||
var through = require('through'); | ||
var through2 = require('through2'); | ||
var Buffer = require('buffer').Buffer; // Included for explicit Browserify support. | ||
@@ -34,6 +34,6 @@ | ||
var ws = websocket(wsurl); | ||
var out = through(bufferCheck); | ||
var out = through2(bufferCheck); | ||
return ws.pipe(out); | ||
function bufferCheck(chunk) { | ||
function bufferCheck(chunk, enc, callback) { | ||
// If chunk is an ArrayBuffer, this means no encoding was specified, | ||
@@ -47,3 +47,5 @@ // so websocket-stream just passed it along raw, which for websockets | ||
this.queue(chunk); | ||
this.push(chunk); | ||
callback(); | ||
} | ||
@@ -55,3 +57,3 @@ } | ||
var ws = websocket(wsurl); | ||
var input = through(); | ||
var input = through2(); | ||
input.pipe(ws); | ||
@@ -58,0 +60,0 @@ return input; |
{ | ||
"name": "fs-stream-websocket", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "`fs.createReadStream` and `fs.createWriteStream` over a websocket, assumedly in a browser.", | ||
@@ -27,5 +27,5 @@ "main": "server.js", | ||
"dependencies": { | ||
"through": "^2.3.4", | ||
"websocket-stream": "^0.5.1", | ||
"debug": "^0.8.0" | ||
"debug": "^0.8.0", | ||
"through2": "^0.4.1", | ||
"websocket-stream": "^0.5.1" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
@@ -24,3 +24,2 @@ var test = require('tape'); | ||
var all = concat(function(data) { | ||
t.ok(typeof data === 'string', 'data is a string'); | ||
t.equal(JSON.parse(data).main, 'server.js'); | ||
@@ -66,3 +65,3 @@ echo.http.close(t.end); | ||
out.on('end', function() { | ||
out.on('finish', function() { | ||
// There does not _appear_ to be a way to know when the server has | ||
@@ -69,0 +68,0 @@ // actually finished writing the file, since the websocket connection |
7
8154
+ Addedthrough2@^0.4.1
+ Addedcore-util-is@1.0.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedobject-keys@0.4.0(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedthrough2@0.4.2(transitive)
+ Addedxtend@2.1.2(transitive)
- Removedthrough@^2.3.4