@jbrowse/text-indexing-core 4.1.2 → 4.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import readline from 'readline';
2
+ import { Readable } from 'stream';
2
3
  import type { LocalPathLocation, Track, UriLocation } from '../util.ts';
3
- import type { Readable } from 'stream';
4
4
  export declare function isURL(FileName: string): boolean;
5
5
  export declare function getLocalOrRemoteStream({ file, out, onStart, onUpdate, }: {
6
6
  file: string;
@@ -1,9 +1,9 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import readline from 'readline';
4
+ import { Readable } from 'stream';
4
5
  import { fileURLToPath } from 'url';
5
6
  import { createGunzip } from 'zlib';
6
- import fetch from 'node-fetch';
7
7
  export function isURL(FileName) {
8
8
  let url;
9
9
  try {
@@ -38,11 +38,24 @@ export async function getLocalOrRemoteStream({ file, out, onStart, onUpdate, })
38
38
  if (!body) {
39
39
  throw new Error(`Failed to fetch ${file}: no response body`);
40
40
  }
41
- body.on('data', chunk => {
41
+ const nodeStream = body instanceof Readable
42
+ ? body
43
+ : new Readable({
44
+ async read() {
45
+ const reader = body.getReader();
46
+ let result = await reader.read();
47
+ while (!result.done) {
48
+ this.push(result.value);
49
+ result = await reader.read();
50
+ }
51
+ this.push(null);
52
+ },
53
+ });
54
+ nodeStream.on('data', chunk => {
42
55
  receivedBytes += chunk.length;
43
56
  onUpdate(receivedBytes);
44
57
  });
45
- return body;
58
+ return nodeStream;
46
59
  }
47
60
  else {
48
61
  const localPath = convertFileUrlToPath(file) ?? file;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/text-indexing-core",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "type": "module",
5
5
  "description": "JBrowse 2 core text indexing routines for parsing GFF3 and VCF files",
6
6
  "keywords": [
@@ -30,9 +30,7 @@
30
30
  "files": [
31
31
  "esm"
32
32
  ],
33
- "dependencies": {
34
- "node-fetch": "^2.7.0"
35
- },
33
+ "dependencies": {},
36
34
  "publishConfig": {
37
35
  "access": "public"
38
36
  },