I worked around it in python using GDAL Driver. If you want to export it as a file. I'm not sure it'll work as variable in node.js, but there it is:
let rows = await con.all(COPY (SELECT geometry FROM duckdata LIMIT 10) TO 'my.json' WITH (FORMAT GDAL, DRIVER 'GeoJSON')
);