@cloudrac3r/stream-type
v1.0.0
Published
Read the start of a stream to determine its mime type. Returns the mime type and a new consumable stream.
Downloads
214
Readme
@cloudrac3r/stream-type
Read the start of a stream to determine its mime type. Returns the mime type and a new consumable stream.
Like stream-mime-type, but zero dependencies.
Only detects these types: image/png, image/jpeg, image/gif, image/webp.
Usage
const input = fs.createReadStream("test/files/niko_tear_wipe.png")
const {type, streamThrough} = await streamType(input)
// type -> "image/png"
// streamThrough -> import("node:stream").ReadableUse the returned streamThrough to access the complete stream data without re-reading it after determining its type.
License
AGPL version 3.0 only
