node-filewalker icon indicating copy to clipboard operation
node-filewalker copied to clipboard

TypeError: "encoding" must be a valid string encoding

Open odilitime opened this issue 8 years ago • 6 comments

node v6.2.2 got the following, guessing because this directory has some funky filenames:

TypeError: "encoding" must be a valid string encoding at fromString (buffer.js:226:11) at Function.Buffer.from (buffer.js:131:12) at createWriteReq (net.js:749:45) at WriteStream.Socket._writeGeneric (net.js:701:11) at WriteStream.Socket._write (net.js:724:8) at doWrite (_stream_writable.js:307:12) at writeOrBuffer (_stream_writable.js:293:5) at WriteStream.Writable.write (_stream_writable.js:220:11) at WriteStream.Socket.write (net.js:650:40) at Filewalker.

odilitime avatar Jun 25 '16 22:06 odilitime

Just realized there's no filewalker code in this path actually

odilitime avatar Jun 25 '16 23:06 odilitime

I am facing the same issue...Can someone help how to resolve it TypeError: "encoding" must be a valid string encoding at fromString (buffer.js:192:11) at Function.Buffer.from (buffer.js:100:12) at createWriteReq (net.js:760:45) at Socket._writeGeneric (net.js:711:11) at Socket._write (net.js:734:8) at doWrite (_stream_writable.js:334:12) at clearBuffer (_stream_writable.js:441:7) at Socket.Writable.uncork (_stream_writable.js:270:7) at ServerResponse.OutgoingMessage.end (_http_outgoing.js:607:21) at Query._callback (/home/ubuntu/cmpe281individual/routes/grades.js:55:20)

CoderCouple avatar May 03 '17 01:05 CoderCouple

try creating an .on('error') listener

odilitime avatar May 05 '17 12:05 odilitime

Node makes it a bit hard sometimes to find the real cause of such errors.

Can you provide a "longer" Stacktrace with https://www.npmjs.com/package/longjohn ?

oleics avatar May 05 '17 12:05 oleics

Share your code which is giving error. Reason for error, incorrect type e.g. res.end("--otp saved--");//ok e.g. res.end("--otp saved--","ok");//fails with above error or res.end("--otp saved--",req.body.paramName);

sam700007 avatar Dec 11 '17 07:12 sam700007

@odilitime Try to check whether the proper encoding type is being passed. See available options here.

@odilitime @oleics Since it is not related to filewalker, I would recommend to close this issue.

thiagodp avatar Jan 22 '18 17:01 thiagodp