import { isTextMediaType } from "../../../../views/Request/consts/mediaTypes.js";
import MimeType from "whatwg-mimetype";
//#region src/v2/blocks/operation-block/helpers/decode-buffer.ts
/**
* Decode the buffer according to its content-type
*
* @returns The decoded string or Blob
*/
var decodeBuffer = (buffer, contentType) => {
	const mimeType = new MimeType(contentType);
	if (isTextMediaType(mimeType.essence)) return new TextDecoder(mimeType.parameters.get("charset")).decode(buffer);
	return new Blob([buffer], { type: mimeType.essence });
};
//#endregion
export { decodeBuffer };

//# sourceMappingURL=decode-buffer.js.map