mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-06 22:20:55 +03:00
use TransformStream if available
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
/* global ReadableStream */
|
||||
/* global ReadableStream TransformStream */
|
||||
|
||||
export function transform(readable, transformer) {
|
||||
export function transformStream(readable, transformer) {
|
||||
if (typeof TransformStream === 'function') {
|
||||
return readable.pipeThrough(new TransformStream(transformer));
|
||||
}
|
||||
const reader = readable.getReader();
|
||||
const tstream = new ReadableStream({
|
||||
start(controller) {
|
||||
|
||||
Reference in New Issue
Block a user