We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Is there Typescript NPM for Aspose.Slides?

The github repo (https://github.com/aspose-slides-cloud/aspose-slides-cloud-nodejs) contains the sdk in typescript, however, the npm it points to is javascript, and I cannot find typescript npm

Thank you for posting the inquiry.

I’ve added a ticket with ID SLIDESCLOUD-1393 in our issue tracking system. Our development team will consider your requirements. We will reply to you as soon as possible.

Our development team investigated the issue. You can download the 22.1.1 package version. It contains the .ts files.

I tried to use it, but I get errors.

1 - number of APIs user ‘http.ClientResponse’ which seems to be deprecated.
2 - The examples for using ‘convert’ API show how we can pass the result of ‘fs.createReadStream()’ as first argument to ‘convert’. However ‘convert’ first argument is of type ‘Buffer’ and typescript conplains that fs.ReadStream is not convertable to ‘Buffer’

Could you please share code examples that raise the errors you faced? It would be great if you could also share error messages for these code examples. Then we will do our best to help you.

Here is sample code:

import api from ‘asposeslidescloud’;
import fs from ‘fs’;

const myClientId = “xxxxx”
const myClientSecret = “xxxxx”

const dir = “/users/ronnie/work/mvp-be/”;
const inputFile = “samplepptx.pptx”;

const slidesApi = new api.SlidesApi(myClientId, myClientSecret);
console.log(‘starting conversion’)
const p = slidesApi.convert(fs.createReadStream(dir + inputFile), ‘pdf’, undefined);
p.then((response) => {
console.log(‘finished conversion") //, JSON.stringify(response.response’)
fs.writeFile("/users/ronnie/work/mvp-be/MyPresentation1.pdf", response.body, (err) => {
if (err) throw err;
.catch((err) => {
console.log(“error in convert”, err);

This is the error I’m getting:

(node:14477) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use node --trace-warnings ... to show where the warning was created)
return new TSError(diagnosticText, diagnosticCodes);
TSError: ⨯ Unable to compile TypeScript:
…/…/Library/Application Support/JetBrains/WebStorm2021.2/scratches/aspose2pdf-error.ts:14:32 - error TS2345: Argument of type ‘ReadStream’ is not assignable to parameter of type ‘Buffer’.
Type ‘ReadStream’ is missing the following properties from type ‘Buffer’: write, toJSON, equals, compare, and 79 more.

14 const p = slidesApi.convert(fs.createReadStream(dir + inputFile), ‘pdf’, undefined);

at createTSError (/Users/ronnie/work/mvp-be/node_modules/ts-node/src/index.ts:692:12)
at reportTSError (/Users/ronnie/work/mvp-be/node_modules/ts-node/src/index.ts:696:19)
at getOutput (/Users/ronnie/work/mvp-be/node_modules/ts-node/src/index.ts:883:36)
at Object.compile (/Users/ronnie/work/mvp-be/node_modules/ts-node/src/index.ts:1185:30)
at Module.m._compile (/Users/ronnie/work/mvp-be/node_modules/ts-node/src/index.ts:1309:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Object.require.extensions.<computed> [as .ts] (/Users/ronnie/work/mvp-be/node_modules/ts-node/src/index.ts:1313:12)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:199:29) {

diagnosticText: “\x1B[96m…/…/Library/Application Support/JetBrains/WebStorm2021.2/scratches/aspose2pdf-error.ts\x1B[0m:\x1B[93m14\x1B[0m:\x1B[93m32\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2345: \x1B[0mArgument of type ‘ReadStream’ is not assignable to parameter of type ‘Buffer’.\n” +
" Type ‘ReadStream’ is missing the following properties from type ‘Buffer’: write, toJSON, equals, compare, and 79 more.\n" +
‘\n’ +
“\x1B[7m14\x1B[0m const p = slidesApi.convert(fs.createReadStream(dir + inputFile), ‘pdf’, undefined);\n” +
‘\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\x1B[0m\n’,
diagnosticCodes: [ 2345 ]


If I use the same code, in an “mjs” file (without typescript) works fine.

Thank you for the additional data. I’ve passed it to our development team.