Skip to content

Commit

Permalink
Rename option.signal to option.abortSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Sep 8, 2024
1 parent 8f4ece5 commit fa3eff0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ export function fileTypeStream(webStream: AnyWebReadableStream<Uint8Array>, opti
export declare class FileTypeParser {
detectors: Iterable<Detector>;

constructor(options?: {customDetectors?: Iterable<Detector>; abortSignal: AbortSignal});
constructor(options?: {customDetectors?: Iterable<Detector>; signal: AbortSignal});

/**
Works the same way as {@link fileTypeFromBuffer}, additionally taking into account custom detectors (if any were provided to the constructor).
Expand Down
2 changes: 1 addition & 1 deletion core.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class FileTypeParser {
constructor(options) {
this.detectors = options?.customDetectors;
this.tokenizerOptions = {
abortSignal: options?.abortSignal,
abortSignal: options?.signal,
};
this.fromTokenizer = this.fromTokenizer.bind(this);
this.fromBuffer = this.fromBuffer.bind(this);
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ test('.fileTypeFromStream() method - be able to abort operation', async t => {

const shortStream = new MyStream();
const abortController = new AbortController();
const parser = new NodeFileTypeParser({abortSignal: abortController.signal});
const parser = new NodeFileTypeParser({signal: abortController.signal});
const promiseFileType = parser.fromStream(shortStream);
abortController.abort(); // Abort asynchronous operation: reading from shortStream
const error = await t.throwsAsync(promiseFileType);
Expand Down

0 comments on commit fa3eff0

Please sign in to comment.