How can I use builtin node modules in SuiteScript?...
# suitescript
a
How can I use builtin node modules in SuiteScript? Such as
net
. Is there a way to download that module from somewhere?
c
There's no direct import. Some of them may/may not work depending on what they do.
99% of the time you do not need something like this so what is it you are trying to do?
a
Unfortunately I think I do. I am trying to print to a zebra printer from a server. I forwarded a port and am trying to open a socket and send some zpl to it.
c
I have never heard of someone trying to do that from suitescript. I've done stuff for zebra printers a ton at most it was just get the PDF done. The zebra printers or the computer handling the printing did everything else.
Does the thing have a rest api?
a
I don't think so. It is this model.
You said some of them may/may not work. How can I try to get
net
into netsuite?
Paging @battk He would know what is and is not possible.
c
SA: 61154 Explains how to import third party modules. The node module would have to be pretty vanilla and have correct exports for it to work. Also, this printer stopped even being supported by Zebra 3 years ago. They should really look into that before an issue pops up. What I've seen people do in the past is have a machine hooked up to the printer that monitors the email and does a print job when the email comes in avoiding having to deal with this.
a
I understand your points but I really dislike middleware. If I can communicate directly to the printer it would be golden.
b
the normal tool to use node code in a browser is a bundler like browserify or webpack
I would expect you to have a low chance of accomplishing this clientside in a browser, with that chance depending on your printer supporting a websocket
I would expect you to have 0 chance doing this in serverside suitescript, there is no module for tcp
a
OK. I officially give up and will create middleware.