feat(ffmpeg): abort signal (#573)

* feat(ffmpeg): abort signal

* with test
This commit is contained in:
Antoine BERNIER
2023-10-09 15:51:08 +02:00
committed by GitHub
parent cf9cf11c6d
commit efaae603d8
2 changed files with 134 additions and 45 deletions

View File

@@ -135,4 +135,18 @@ describe(genName("FFmpeg.exec()"), function () {
const ret = await ffmpeg.exec(["-i", "video.mp4", "video.avi"], 1);
expect(ret).to.equal(1);
});
it("should abort", () => {
const controller = new AbortController();
const { signal } = controller;
const promise = ffmpeg.exec(["-i", "video.mp4", "video.avi"], undefined, {
signal,
});
controller.abort();
return promise.catch((err) => {
expect(err.name).to.equal("AbortError");
});
});
});