#Parsing .EML using workers

1 messages · Page 1 of 1 (latest)

reef merlin
#

i have tried using a variety of mail parsers with workers but since workers does not have full nodejs compatibility, i am unable to use buffer or stream etc which is used by popular libs such as mailparser. is there a workaround or a compatible lib which could do it on workers?

reef merlin
#

✘ [ERROR] Could not resolve "buffer"

  node_modules/string_decoder/node_modules/safe-buffer/index.js:2:21:
    2 │ var buffer = require('buffer')
      ╵                      ~~~~~~~~
#

[ERROR] Could not resolve "stream"

  node_modules/mailsplit/lib/node-rewriter.js:5:26:
    5 │ const Transform = require('stream').Transform;
      ╵                           ~~~~~~~~
mystic hatch
#

Did you enable nodejs-compat flag in wrangler config?

reef merlin
#

yes.

#

compatibility_flags = [ "nodejs_compat" ]

#

wrangler.toml

mystic hatch
#

i can use mailparser and buffer-dependent libs just fine, do you have a full example?