_path2.default.basename不是angular中使用convertapi的函数 &



我正在尝试使用以下文档将convertapi集成到我的Angular 11应用程序中

https://www.npmjs.com/package/convertapi

我需要把pdf转换成图像,

当我试图上传文件时,我得到

_path2.default.basename is not a function

下面是我如何在我的组件

中实现的

进口
import ConvertAPI from 'convertapi';

启动

const convertapi = new ConvertAPI('my actual api-secret ');

转换
convertapi.convert('jpg', { File: file }) //'file' is actual file object, also tried pdf url
.then(function(result: any) {
console.log(result)
})
.catch(function(e: any) {
console.log(e.toString()); // this prints out the error message
});

我错过了什么吗?

这个库是一个非模块,关于如何在Angular中使用它,请参考这个问题:在TS中导入一个非模块

这是文档:https://github.com/ConvertAPI/convertapi-js

最新更新