Skip to content

Commit

Permalink
Add instructions on how to load file-type in a CommonJS + TypeScript (#…
Browse files Browse the repository at this point in the history
…700)

Co-authored-by: Sindre Sorhus <[email protected]>
  • Loading branch information
Borewit and sindresorhus authored Dec 11, 2024
1 parent a30977c commit e2f1a1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ We accept contributions for commonly used modern file formats, not historical or
npm install file-type
```

**This package is an ESM package. Your project needs to be ESM too. [Read more](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).**
**This package is an ESM package. Your project needs to be ESM too. [Read more](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). For TypeScript + CommonJS, see [`load-esm`](https://github.com/Borewit/load-esm).**

If you use it with Webpack, you need the latest Webpack version and ensure you configure it correctly for ESM.

## Usage

#### Node.js
### Node.js

Determine file type from a file:

Expand Down Expand Up @@ -91,7 +91,7 @@ const write = fs.createWriteStream(`decrypted.${streamWithFileType.fileType.ext}
streamWithFileType.pipe(write);
```

#### Browser
### Browser

```js
import {fileTypeFromStream} from 'file-type';
Expand Down

0 comments on commit e2f1a1c

Please sign in to comment.