From e24d47cda43d0ca89b007d0a19cdd78fc48ab8af Mon Sep 17 00:00:00 2001 From: s Date: Thu, 10 May 2018 17:36:30 -0400 Subject: [PATCH] Update documentation to reflect Buffer constructor deprecation in Node --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 58086bd8..4ecae2cc 100644 --- a/README.md +++ b/README.md @@ -97,9 +97,10 @@ packages. In Node.js v4 and later `Buffer` objects are backed by `Uint8Array`s, so you can freely pass them to TweetNaCl.js functions as arguments. The returned objects are still `Uint8Array`s, so if you need `Buffer`s, you'll have to -convert them manually; make sure to convert using copying: `new Buffer(array)`, -instead of sharing: `new Buffer(array.buffer)`, because some functions return -subarrays of their buffers. +convert them manually; make sure to convert using copying: `Buffer.from(array)` +(or `new Buffer(array)` in Node.js v4 or earlier), instead of sharing: +`Buffer.from(array.buffer)` (or `new Buffer(array.buffer)` Node 4 or earlier), +because some functions return subarrays of their buffers. ### Public-key authenticated encryption (box)