license import { DataSource } from '../datasource' ; import { ByteChunkIterator } from '../iterators/byte_chunk_iterator' ; import { FileChunkIteratorOptions } from '../iterators/file_chunk_iterator' ; import { urlChunkIterator } from '../iterators/url_chunk_iterator' ; import { isLocalPath } from '../util/source_util' ; import { FileDataSource } from './file_data_source' ; export class URLDataSource extends DataSource { param url param options constructor ( protected readonly url , protected readonly fileOptions = { } ) { super ( ) ; } async iterator ( ) { if ( isLocalPath ( this . url ) ) { return ( new FileDataSource ( this . url as string , this . fileOptions ) ) . iterator ( ) ; } else { return urlChunkIterator ( this . url , this . fileOptions ) ; } } }