@travetto/asset
Advanced tools
Comparing version 4.0.10 to 4.1.0
{ | ||
"name": "@travetto/asset", | ||
"version": "4.0.10", | ||
"version": "4.1.0", | ||
"description": "Modular library for storing and retrieving binary assets", | ||
@@ -28,4 +28,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/di": "^4.0.7", | ||
"@travetto/model": "^4.0.7", | ||
"@travetto/di": "^4.1.0", | ||
"@travetto/model": "^4.1.0", | ||
"@types/mime": "^3.0.4", | ||
@@ -36,3 +36,3 @@ "file-type": "^16.5.4", | ||
"peerDependencies": { | ||
"@travetto/test": "^4.0.7" | ||
"@travetto/test": "^4.1.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "peerDependenciesMeta": { |
@@ -1,2 +0,2 @@ | ||
import { Readable } from 'node:stream'; | ||
import { PassThrough } from 'node:stream'; | ||
@@ -88,13 +88,13 @@ import { Inject, Injectable } from '@travetto/di'; | ||
const info = await this.describe(location); | ||
let stream: Readable; | ||
let extra: Partial<AssetResponse> | undefined; | ||
const stream = new PassThrough(); | ||
const extra: Partial<AssetResponse> = {}; | ||
let load: () => void; | ||
if (start === undefined) { | ||
stream = await this.#store.getStream(location); | ||
load = (): void => { this.#store.getStream(location).then(v => v.pipe(stream)); }; | ||
} else { | ||
const res = await this.#store.getStreamPartial(location, start, end); | ||
stream = res.stream; | ||
extra = { range: res.range }; | ||
extra.range = StreamUtil.enforceRange(start, end, info.size); | ||
load = (): void => { this.#store.getStreamPartial(location, start, end).then(v => v.stream.pipe(stream)); }; | ||
} | ||
return { stream: () => stream, ...info, ...extra }; | ||
return { stream: () => (load(), stream), ...info, ...extra }; | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28587
Updated@travetto/di@^4.1.0
Updated@travetto/model@^4.1.0