@adobe/pdfservices-node-sdk
Version:
The Adobe PDF Services Node.js SDK provides APIs for creating, combining, exporting and manipulating PDFs.
37 lines • 1.27 kB
JavaScript
;
/*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it. If you have received this file from a source other than Adobe,
* then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.IOUtil = void 0;
const SDKError_1 = require("../../exception/SDKError");
class IOUtil {
static streamToByteArray(readableStream) {
try {
const chunks = [];
return new Promise((resolve, reject) => {
readableStream.on("data", (chunk) => {
chunks.push(chunk);
});
readableStream.on("end", () => {
resolve(Buffer.concat(chunks));
});
readableStream.on("error", (error) => {
reject(error);
});
});
}
catch (e) {
throw new SDKError_1.SDKError("Error occurred while converting stream to byte array");
}
}
}
exports.IOUtil = IOUtil;
//# sourceMappingURL=IOUtil.js.map