如何在ES6中导入传递subClass参数的节点模块?

时间:2022-03-14 19:41:18

In JS I require in the node module gm (which I want to use with imageMagick rather than the default graphicsMagick) while passing an argument like this:

在JS中我需要在节点模块gm(我想用imageMagick而不是默认的graphicsMagick)中传递这样的参数:

 var gm = require('gm').subClass({ imageMagick: true });

How can I do that in ES6?

我怎么能在ES6中做到这一点?

import gm from "gm";
gm.subClass({ imageMagick: true });

doesn't work, because gm defaults to GraphicsMagick which isn't installed.

不起作用,因为gm默认为未安装的GraphicsMagick。

1 个解决方案

#1


5  

Answer from @Felix Kling works:

来自@Felix Kling的回答:

import gm from "gm";
const im = gm.subClass({ imageMagick: true });

...using im from here on!

...从这里使用即时通讯!

#1


5  

Answer from @Felix Kling works:

来自@Felix Kling的回答:

import gm from "gm";
const im = gm.subClass({ imageMagick: true });

...using im from here on!

...从这里使用即时通讯!