Update website and send total=-1 when no content-type
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
"version": "0.11.5",
|
||||
"description": "FFmpeg WebAssembly version for browser",
|
||||
"main": "./dist/umd/ffmpeg.js",
|
||||
"types": "./dist/umd/ffmpeg.d.ts",
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/umd/ffmpeg.d.ts",
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"import": "./dist/esm/index.js",
|
||||
"require": "./dist/umd/ffmpeg.js"
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
"lint": "eslint src",
|
||||
"clean": "rimraf dist",
|
||||
"build:umd": "webpack",
|
||||
"build:d": "tsc -p tsconfig.d.json",
|
||||
"build:esm": "tsc -p tsconfig.esm.json",
|
||||
"build": "npm-run-all clean build:*",
|
||||
"docs": "typedoc --entryPointStrategy expand ./src",
|
||||
|
||||
@@ -165,7 +165,7 @@ export class FFmpeg extends EventEmitter {
|
||||
*/
|
||||
public load = (config: FFMessageLoadConfig = {}): Promise<IsFirst> => {
|
||||
if (!this.#worker) {
|
||||
this.#worker = new Worker(new URL("./worker.ts", import.meta.url));
|
||||
this.#worker = new Worker(new URL("./worker", import.meta.url));
|
||||
this.#registerHandlers();
|
||||
}
|
||||
return this.#send({
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
export const ERROR_RESPONSE_BODY_READER = new Error(
|
||||
"failed to get response body reader"
|
||||
);
|
||||
export const ERROR_ZERO_CONTENT_LENGTH = new Error(
|
||||
"failed to get Content-Length"
|
||||
);
|
||||
export const ERROR_UNKNOWN_MESSAGE_TYPE = new Error("unknown message type");
|
||||
export const ERROR_NOT_LOADED = new Error(
|
||||
"ffmpeg is not loaded, call `await ffmpeg.load()` first"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
ERROR_RESPONSE_BODY_READER,
|
||||
ERROR_ZERO_CONTENT_LENGTH,
|
||||
ERROR_INCOMPLETED_DOWNLOAD,
|
||||
} from "./errors";
|
||||
import { HeaderContentLength } from "./const";
|
||||
@@ -28,8 +27,8 @@ export const downloadWithProgress = async (
|
||||
let buf;
|
||||
|
||||
try {
|
||||
const total = parseInt(resp.headers.get(HeaderContentLength) || "0");
|
||||
if (total === 0) throw ERROR_ZERO_CONTENT_LENGTH;
|
||||
// Set total to -1 to indicate that there is not Content-Type Header.
|
||||
const total = parseInt(resp.headers.get(HeaderContentLength) || "-1");
|
||||
|
||||
const reader = resp.body?.getReader();
|
||||
if (!reader) throw ERROR_RESPONSE_BODY_READER;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outFile": "dist/umd/ffmpeg.d.ts"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user