Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-05-30 08:50:40 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-05-30 08:50:40 +0300
commit69227bd5899294d43b9bee0f5a075a8190b1af75 (patch)
tree1bf6f42ee64c9b0e1c86862422ef7764e91599eb /test/client-seed.js
parent7fb250f6767796bdc88f9a1d4536dbc6c731e465 (diff)
Use safe-buffer
Use the new Buffer APIs from Node v6 for added security. For example, Buffer.from() will throw if passed a number, unlike Buffer() which allocated UNINITIALIZED memory. Use the safe-buffer package for compatibility with previous versions of Node.js, including v4.x, v0.12, and v0.10. https://github.com/feross/safe-buffer
Diffstat (limited to 'test/client-seed.js')
-rw-r--r--test/client-seed.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/client-seed.js b/test/client-seed.js
index 1f50d9b..eede4a3 100644
--- a/test/client-seed.js
+++ b/test/client-seed.js
@@ -1,5 +1,6 @@
/* global Blob */
+var Buffer = require('safe-buffer').Buffer
var fixtures = require('webtorrent-fixtures')
var test = require('tape')
var WebTorrent = require('../')
@@ -34,7 +35,7 @@ test('client.seed: torrent file (Buffer), set name on buffer', function (t) {
client.on('error', function (err) { t.fail(err) })
client.on('warning', function (err) { t.fail(err) })
- var buf = new Buffer(fixtures.leaves.content)
+ var buf = Buffer.from(fixtures.leaves.content)
buf.name = 'Leaves of Grass by Walt Whitman.epub'
client.seed(buf, function (torrent) {