@chunkd/source-http 10.1.2 → 11.0.1

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.
package/README.md CHANGED
@@ -1,23 +1,39 @@
1
- # @chunkd/source-url
1
+ # @chunkd/source-http
2
2
 
3
-
4
- Load a chunks of a file from a URL Source using `fetch`
3
+ Load a chunks of a file from a HTTP(s) Source using `fetch`
5
4
 
6
5
  ## Usage
7
6
 
8
- ```javascript
7
+ ```typescript
9
8
  import { SourceHttp } from '@chunkd/source-http';
10
9
 
11
- const source = new SourceHttp('https://example.com/cog.tif');
10
+ const source = new SourceHttp(new URL('https://example.com/cog.tif'));
11
+
12
+ const firstBuffer = await source.fetchBytes(0, 1024); // Load the first 1KB from the source
13
+ const lastBuffer = await source.fetchBytes(-1024); // load the last 1KB from the source
12
14
 
13
- await source.loadBytes(0, 1024)
15
+ const size = source.metadata?.size; // File size if metadata has been fetched
14
16
  ```
15
17
 
16
- #### Nodejs <18
17
- Node.js <18 does not come with a default `fetch` function, Users can specify a `fetch` like object
18
+ ### Relative URLs
19
+
20
+ for relative urls, use `document.baseURI`
21
+
22
+ ```typescript
23
+ const source = new SourceHttp(new URL('../cog.tif', document.baseURI));
24
+ ```
25
+
26
+ ### Advanced Usage
27
+
28
+ For caching, block alignment and fetch grouping see [@chunkd/middleware](https://www.npmjs.com/package/@chunkd/middleware) and [@chunkd/fs](https://www.npmjs.com/package/@chunkd/fs)
29
+
30
+ ## Nodejs <18
31
+
32
+ Node.js <18 does not come with a default `fetch` function, a `fetch` method must be provided before being able to be used.
18
33
 
19
34
  ```javascript
20
- import {fetch} from 'node-fetch';
35
+ import { SourceHttp } from '@chunkd/source-http';
36
+ import { fetch } from 'node-fetch';
21
37
 
22
38
  SourceHttp.fetch = fetch;
23
39
  ```
@@ -1,4 +1,3 @@
1
1
  export interface HttpHeaders {
2
2
  Range: string;
3
3
  }
4
- //# sourceMappingURL=source.http.test.d.ts.map
@@ -0,0 +1,97 @@
1
+ import assert from 'node:assert';
2
+ import { after, afterEach, before, beforeEach, describe, it } from 'node:test';
3
+ import { SourceHttp } from '../index.js';
4
+ describe('SourceHttp', () => {
5
+ let source;
6
+ let ranges;
7
+ before(() => {
8
+ // Fake fetch that returns the number of the byte that was requested
9
+ SourceHttp.fetch = (_, obj) => {
10
+ const rangeHeader = obj?.headers?.Range;
11
+ if (rangeHeader == null)
12
+ throw new Error('No headers');
13
+ const [startByte, endByte] = rangeHeader
14
+ .split('=')[1]
15
+ .split('-')
16
+ .map((i) => parseInt(i, 10));
17
+ const bytes = [];
18
+ ranges.push(rangeHeader);
19
+ for (let i = startByte; i < endByte; i++) {
20
+ bytes.push(i);
21
+ }
22
+ const buffer = new Uint8Array(bytes).buffer;
23
+ const arrayBuffer = () => Promise.resolve(buffer);
24
+ return Promise.resolve({ arrayBuffer, ok: true, headers: new Map() });
25
+ };
26
+ });
27
+ after(() => {
28
+ SourceHttp.fetch = fetch;
29
+ });
30
+ beforeEach(() => {
31
+ source = new SourceHttp(new URL('https://foo'));
32
+ ranges = [];
33
+ });
34
+ it('should fetch part of the file', async () => {
35
+ await source.fetch(0, 1024);
36
+ assert.equal(ranges[0], 'bytes=0-1023');
37
+ });
38
+ it('should fetch part of the file multiple times', async () => {
39
+ await source.fetch(0, 1024);
40
+ assert.equal(ranges[0], 'bytes=0-1023');
41
+ await source.fetch(0, 1024);
42
+ assert.equal(ranges[1], 'bytes=0-1023');
43
+ });
44
+ it('should fetch negative parts', async () => {
45
+ await source.fetch(-1024);
46
+ assert.equal(ranges[0], 'bytes=-1024');
47
+ });
48
+ it('should fetch at offsets parts', async () => {
49
+ await source.fetch(1024, 1024);
50
+ assert.equal(ranges[0], 'bytes=1024-2047');
51
+ });
52
+ it('should support string URLs', () => {
53
+ const source = new SourceHttp('https://foo.com/bar');
54
+ assert.equal(source.url.href, 'https://foo.com/bar');
55
+ });
56
+ // Should these throw if import.meta.url is not a http?
57
+ describe('import.meta.url', () => {
58
+ it('should support "/"', () => {
59
+ const source = new SourceHttp('/bar.txt');
60
+ // Windows will report `file://D:/bar.txt` linux `file:///bar.txt`
61
+ const baseUrl = new URL('/', import.meta.url);
62
+ assert.equal(source.url.href, baseUrl.href + 'bar.txt');
63
+ });
64
+ it('should support "./', () => {
65
+ const source = new SourceHttp('./bar.txt');
66
+ assert.equal(source.url.protocol, 'file:');
67
+ assert.ok(source.url.href.endsWith('/src/bar.txt'));
68
+ });
69
+ });
70
+ describe('document.baseURI', () => {
71
+ let oldDoc;
72
+ beforeEach(() => {
73
+ oldDoc = global.document;
74
+ global.document = { baseURI: 'https://example.com/foo/index.html' };
75
+ });
76
+ afterEach(() => {
77
+ global.document = oldDoc;
78
+ });
79
+ it('should use support "/" ', () => {
80
+ const source = new SourceHttp('/bar.txt');
81
+ assert.equal(source.url.href, 'https://example.com/bar.txt');
82
+ });
83
+ it('should support ".."', () => {
84
+ const sourceRelUp = new SourceHttp('../bar.txt');
85
+ assert.equal(sourceRelUp.url.href, 'https://example.com/bar.txt');
86
+ });
87
+ it('should support "./"', () => {
88
+ const sourceRelUp = new SourceHttp('./bar.txt');
89
+ assert.equal(sourceRelUp.url.href, 'https://example.com/foo/bar.txt');
90
+ });
91
+ it('should should support "../../../"', () => {
92
+ const sourceRelUp = new SourceHttp('../../../bar.txt');
93
+ assert.equal(sourceRelUp.url.href, 'https://example.com/bar.txt');
94
+ });
95
+ });
96
+ });
97
+ //# sourceMappingURL=source.http.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.http.test.js","sourceRoot":"","sources":["../../../src/__test__/source.http.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAoB,UAAU,EAAE,MAAM,aAAa,CAAC;AAM3D,QAAQ,CAAC,YAAY,EAAE,G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EH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;YACjC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;YAC1C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;YAC7B,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC;YACjD,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;YAC7B,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;YAChD,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,iCAAiC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAC;YACvD,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { Source, SourceMetadata } from '@chunkd/source';
2
+ /** Minimal typings for fetch */
3
+ export interface FetchLikeOptions {
4
+ method?: string;
5
+ headers?: Record<string, string>;
6
+ }
7
+ export interface FetchLikeResponse {
8
+ ok: boolean;
9
+ statusText: string;
10
+ status: number;
11
+ headers: {
12
+ get(k: string): string | null;
13
+ };
14
+ body: unknown;
15
+ arrayBuffer(): Promise<ArrayBuffer>;
16
+ }
17
+ export type FetchLike = (url: string | URL, opts?: FetchLikeOptions) => Promise<FetchLikeResponse>;
18
+ /** Load the ETag and content-range from the response */
19
+ export declare function getMetadataFromResponse(response: FetchLikeResponse): SourceMetadata;
20
+ export declare class SourceHttp implements Source {
21
+ type: string;
22
+ url: URL;
23
+ constructor(url: URL | string);
24
+ /** Attempt to parse a relative string into a URL */
25
+ static tryUrl(s: string): URL;
26
+ /** Optional metadata, only populated if a .head() or .fetchBytes() has already been returned */
27
+ metadata?: SourceMetadata;
28
+ private _head?;
29
+ head(): Promise<SourceMetadata>;
30
+ fetch(offset: number, length?: number): Promise<ArrayBuffer>;
31
+ static fetch: FetchLike;
32
+ }
@@ -0,0 +1,70 @@
1
+ import { ContentRange, SourceError } from '@chunkd/source';
2
+ /** Load the ETag and content-range from the response */
3
+ export function getMetadataFromResponse(response) {
4
+ const metadata = { size: -1 };
5
+ const contentRange = response.headers.get('content-range');
6
+ if (contentRange != null)
7
+ metadata.size = ContentRange.parseSize(contentRange);
8
+ metadata.eTag = response.headers.get('etag') ?? undefined;
9
+ metadata.contentType = response.headers.get('content-type') ?? undefined;
10
+ metadata.contentDisposition = response.headers.get('content-disposition') ?? undefined;
11
+ return metadata;
12
+ }
13
+ export class SourceHttp {
14
+ constructor(url) {
15
+ this.type = 'http';
16
+ this.url = typeof url === 'string' ? SourceHttp.tryUrl(url) : url;
17
+ }
18
+ /** Attempt to parse a relative string into a URL */
19
+ static tryUrl(s) {
20
+ try {
21
+ return new URL(s);
22
+ }
23
+ catch (_e) {
24
+ if (typeof document !== 'undefined')
25
+ return new URL(s, document.baseURI);
26
+ // Should these throw if import.meta.url is not a http?
27
+ return new URL(s, import.meta.url);
28
+ }
29
+ }
30
+ head() {
31
+ if (this._head)
32
+ return this._head;
33
+ this._head = SourceHttp.fetch(this.url, { method: 'HEAD' }).then((res) => {
34
+ if (!res.ok) {
35
+ delete this._head;
36
+ throw new Error(`Failed to HEAD ${this.url}`, { cause: { statusCode: res.status, msg: res.statusText } });
37
+ }
38
+ this.metadata = getMetadataFromResponse(res);
39
+ return this.metadata;
40
+ });
41
+ return this._head;
42
+ }
43
+ async fetch(offset, length) {
44
+ try {
45
+ const Range = ContentRange.toRange(offset, length);
46
+ const headers = { Range };
47
+ const response = await SourceHttp.fetch(this.url, { headers });
48
+ if (!response.ok) {
49
+ throw new SourceError(`Failed to fetch ${this.url} ${Range}`, response.status, this, new Error(response.statusText));
50
+ }
51
+ const metadata = getMetadataFromResponse(response);
52
+ if (this.metadata == null) {
53
+ this.metadata = metadata;
54
+ }
55
+ else if (this.metadata.eTag && this.metadata.eTag !== metadata.eTag) {
56
+ // ETag has changed since the last read!
57
+ throw new SourceError(`ETag conflict ${this.url} ${Range} expected: ${this.metadata.eTag} got: ${metadata.eTag}`, 409, this);
58
+ }
59
+ return response.arrayBuffer();
60
+ }
61
+ catch (e) {
62
+ if (SourceError.is(e) && e.source === this)
63
+ throw e;
64
+ throw new SourceError(`Failed to fetch: ${this.url}`, 500, this, e);
65
+ }
66
+ }
67
+ }
68
+ // Allow overwriting the fetcher used (eg testing/node-js)
69
+ SourceHttp.fetch = (a, b) => fetch(a, b);
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAU,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AAiBnF,wDAAwD;AACxD,MAAM,UAAU,uBAAuB,CAAC,QAA2B;IACjE,MAAM,QAAQ,GAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC3D,IAAI,YAAY,IAAI,IAAI;QAAE,QAAQ,CAAC,IAAI,GAAG,YAAY,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAC/E,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAA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AC,IAAI,EAAE,EAC1F,GAAG,EACH,IAAI,CACL,CAAC;aACH;YACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;SAC/B;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI;gBAAE,MAAM,CAAC,CAAC;YACpD,MAAM,IAAI,WAAW,CAAC,oBAAoB,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;SACrE;IACH,CAAC;;AAED,0DAA0D;AACnD,gBAAK,GAAc,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,25 +1,33 @@
1
1
  {
2
2
  "name": "@chunkd/source-http",
3
- "version": "10.1.2",
3
+ "version": "11.0.1",
4
4
  "type": "module",
5
5
  "engines": {
6
- "node": ">=16.0.0"
6
+ "node": ">=18.0.0"
7
7
  },
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/blacha/chunkd.git",
11
11
  "directory": "packages/source-http"
12
12
  },
13
- "main": "./build/index.js",
14
- "types": "./build/index.d.ts",
13
+ "main": "./build/src/index.js",
14
+ "types": "./build/src/index.d.ts",
15
15
  "author": "Blayne Chard",
16
16
  "license": "MIT",
17
- "scripts": {},
17
+ "scripts": {
18
+ "test": "node --test"
19
+ },
18
20
  "dependencies": {
19
- "@chunkd/core": "^10.3.0"
21
+ "@chunkd/source": "^11.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^18.16.19"
20
25
  },
21
26
  "publishConfig": {
22
27
  "access": "public"
23
28
  },
24
- "gitHead": "8d78defccaa9b39123446bf60b53e88052cd1901"
29
+ "files": [
30
+ "build/src"
31
+ ],
32
+ "gitHead": "83869d7cce2dc49011b136d28cb83f023b4443e6"
25
33
  }