wcf.js icon indicating copy to clipboard operation
wcf.js copied to clipboard

Buffer.write(string, encoding, offset[, length]) is no longer supported (Node.js 6.x)

Open integritybit opened this issue 9 years ago • 4 comments

Hello,

Awesome library. Thank you . We are building a proof of concept using your wcf.js and Node 6.x. Getting an error in buffer.js with message "no longer supported"

Here's the error: ` node app.js Hello world buffer.js:735 throw new Error('Buffer.write(string, encoding, offset[, length]) ' + ^

Error: Buffer.write(string, encoding, offset[, length]) is no longer supported at Buffer.write (buffer.js:735:11) at MultipartParser.initWithBoundary (C:\Users\Steve\Desktop\NodejsConsoleApp2\NodejsConsoleApp2\node_modules\formidable\lib\multipart_parser.js:61:17) at Object.MimeReader.parse_multipart (C:\Users\Steve\Desktop\NodejsConsoleApp2\NodejsConsoleApp2\node_modules\ws.js\lib\handlers\client\mtom\mime-reader.js:16:12) at Object.exports.parse_multipart (C:\Users\Steve\Desktop\NodejsConsoleApp2\NodejsConsoleApp2\node_modules\ws.js\lib\handlers\client\mtom\mime-reader.js:58:21) at MtomClientHandler.receive (C:\Users\Steve\Desktop\NodejsConsoleApp2\NodejsConsoleApp2\node_modules\ws.js\lib\handlers\client\mtom\mtom.js:69:22) at C:\Users\Steve\Desktop\NodejsConsoleApp2\NodejsConsoleApp2\node_modules\ws.js\lib\handlers\client\mtom\mtom.js:49:10 at Request._callback (C:\Users\Steve\Desktop\NodejsConsoleApp2\NodejsConsoleApp2\node_modules\ws.js\lib\handlers\client\http.js:27:7) at Request.self.callback (C:\Users\Steve\Desktop\NodejsConsoleApp2\NodejsConsoleApp2\node_modules\request\request.js:187:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) `

Any ideas?

Thank you.

integritybit avatar Sep 15 '16 11:09 integritybit

@integritybit I just ran into this error also wondering if you ever found a solution?

chrisgh1 avatar Jun 02 '17 18:06 chrisgh1

Found the solution. it is a problem in the node module formidable in the file multipart_parser.js on lines 61 and 62. You need to change them to this this.boundary.write('\r\n--', 0, 'ascii'); this.boundary.write(str, 4, 'ascii');

just switch the 2nd and 3rd arguments.

chrisgh1 avatar Jun 02 '17 19:06 chrisgh1

After further investigation it looks like the bug in formidable was fixed in recent versions. I installed formidable version 1.1.1 and removed formidable version 1.0.9 and everything seems to work. I noticed in the package.json that the dev specifically calls for formidable version 1.0.9 ie( "dependencies": { "bufferjs": ">= 1.0.2", "dateformat": ">=1.0.2-1.2.3", "formidable": "=1.0.9")

I don't know if there is any ramifications of using a more updated version of formidable but maybe the dev can chime in.

chrisgh1 avatar Jun 06 '17 19:06 chrisgh1

Thank you @chrisgh1 sorry this is an old comment I know, but it just worked for me.

i5o avatar Aug 14 '20 12:08 i5o