[Pkg-javascript-commits] [node-jsonstream] 25/214: work in modern browsers too
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 1 12:58:34 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-jsonstream.
commit ce43382f0bbae03ae7fb3752d20b32ab60cc5b2b
Author: Max Ogden <mogden at gmail.com>
Date: Sun Apr 8 20:07:05 2012 -0400
work in modern browsers too
---
index.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/index.js b/index.js
index 4018e30..a0bfe3d 100644
--- a/index.js
+++ b/index.js
@@ -64,8 +64,15 @@ exports.parse = function (path) {
stream.readable = true
stream.writable = true
stream.write = function (chunk) {
- if('string' === typeof chunk)
- chunk = new Buffer(chunk)
+ if('string' === typeof chunk) {
+ if ('undefined' === typeof Buffer) {
+ var buf = new Array(chunk.length)
+ for (var i = 0; i < chunk.length; i++) buf[i] = chunk.charCodeAt(i)
+ chunk = new Int32Array(buf)
+ } else {
+ chunk = new Buffer(chunk)
+ }
+ }
parser.write(chunk)
}
stream.end = function (data) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jsonstream.git
More information about the Pkg-javascript-commits
mailing list