node.js - Is there a way to limit the maximum size of a string? -
i have application in wish limit maximum size of message sent across wire connected client. since theoretical maximum of message in nodejs
1.9gb, never want application allocate big chunk of memory if malicious clients tries send over-sized packet.
how can limit incoming message size, say, 1024 bytes?
each character 1 3 bytes in length. can technically substring string desired length.
var limited = fullstring.substring(0, 1024);
or can use package : utf8-binary-cutter
Comments
Post a Comment