azurite
Version:
An open source Azure Storage API compatible server
25 lines • 841 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
class TableBatchUtils {
/**
* Helper to convert a ReadableStream to string.
*
* @static
* @param {(NodeJS.ReadableStream | undefined)} stream
* @return {*} {Promise<string>}
* @memberof TableBatchUtils
*/
static async StreamToString(stream) {
if (stream === undefined) {
throw new Error("undefined stream passed to function!");
}
const chunks = [];
return new Promise((resolve, reject) => {
stream.on("data", (chunk) => chunks.push(chunk));
stream.on("error", reject);
stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
});
}
}
exports.default = TableBatchUtils;
//# sourceMappingURL=TableBatchUtils.js.map
;