You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
516 B

import { BaseSource } from './basesource.js';
import { AbortError } from '../utils.js';
class ArrayBufferSource extends BaseSource {
constructor(arrayBuffer) {
super();
this.arrayBuffer = arrayBuffer;
}
fetchSlice(slice, signal) {
if (signal && signal.aborted) {
throw new AbortError('Request aborted');
}
return this.arrayBuffer.slice(slice.offset, slice.offset + slice.length);
}
}
export function makeBufferSource(arrayBuffer) {
return new ArrayBufferSource(arrayBuffer);
}