Skip to content

fileTypeFromStream throws an error in combination with strtok3@9.0.1 #681

@Borewit

Description

@Borewit

Description

Release of strtok3 v9.0.1, will cause problems with file-type v19.5.0 (reason CI was failing). It exposes a the following issue:

file-type/index.js

Lines 13 to 17 in 0e91f7b

try {
return super.fromTokenizer(tokenizer);
} finally {
await tokenizer.close();
}

where the tokenizer is closed after return the promise, and not after resolving the promise.

Since strtok3 v9.0.1 to tokenizer is actually destroying the stream, which caused file-type to fail to read from the tokenizer.

Existing Issue Check

  • I have searched the existing issues and could not find any related to my problem.

ESM (ECMAScript Module) Requirement Acknowledgment

  • My project is an ESM project and my package.json contains the following entry: "type": "module".

File-Type Scope Acknowledgment

  • I understand that file-type detects binary file types and not text or other formats.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions