From 9a9bdc132f301dc10de4ad6c7d77ac4eea8288d7 Mon Sep 17 00:00:00 2001 From: James Halliday Date: Fri, 25 Mar 2016 16:33:59 -0700 Subject: [PATCH] use toArrayBuffer() only when present (removed in node 0.11): https://github.com/feross/buffer/issues/90 --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 806b33a..be7a0fd 100644 --- a/index.js +++ b/index.js @@ -65,7 +65,11 @@ Level.prototype._put = function (key, value, options, callback) { } var obj = this.convertEncoding(key, value, options) if (Buffer.isBuffer(obj.value)) { - obj.value = new Uint8Array(value.toArrayBuffer()) + if (typeof value.toArrayBuffer === 'function') { + obj.value = new Uint8Array(value.toArrayBuffer()) + } else { + obj.value = new Uint8Array(value) + } } this.idb.put(obj.key, obj.value, function() { callback() }, callback) }