Gathering detailed insights and metrics for stream-head
Gathering detailed insights and metrics for stream-head
Gathering detailed insights and metrics for stream-head
Gathering detailed insights and metrics for stream-head
sandwich-stream
A readable stream that concatenates multiple streams with optional head, tail & join buffers
head-stream
Passthrough stream for acting upon the first buffer emitted in a stream. Like the head command of e.g. head and tail, first and rest.
quiver-stream-head-extractor
quiver-stream-head-extractor ============================
head-tail-stream
Output the first or last lines of a stream
npm install stream-head
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.2
Supply Chain
82.8
Quality
74.8
Maintenance
100
Vulnerability
100
License
TypeScript (97.24%)
JavaScript (2.76%)
Total Downloads
2,757,970
Last Day
8,801
Last Week
50,100
Last Month
251,967
Last Year
1,282,180
4 Stars
18 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Nov 01, 2024
Minified
Minified + Gzipped
Latest Version
3.0.0
Package Id
stream-head@3.0.0
Unpacked Size
9.47 kB
Size
3.17 kB
File Count
4
NPM Version
8.19.3
Node Version
18.13.0
Published on
Feb 07, 2023
Cumulative downloads
Total Downloads
Last Day
17%
8,801
Compared to previous day
Last Week
-15%
50,100
Compared to previous week
Last Month
11.5%
251,967
Compared to previous month
Last Year
79.7%
1,282,180
Compared to previous year
This package allows for inspecting the first n bytes from a stream. A kind of "POSIX head(1)
for JavaScript".
It handles both Node.js streams and Whatwg streams (the Web Streams API used in browsers).
This package provides TypeScript types.
From v3:
The default (and only) exported function takes a readable stream and returns a new readable stream stream
of the same type as the input stream, together with head
of type Uint8Array
. The old stream must not be used anymore, it will be piped to the returned stream. The returned stream will contain everything from the input stream, the first n bytes will be copied to the returned buffer, not consumed. If the stream doesn't contain n bytes, head
will be smaller. If the combined chunks up until n are larger than n, then head
will be larger than n too (it's not truncated).
If the stream is a Node.js ReadableStream it must not be in object-mode but rather transport Node.js Buffers (or typed arrays), and if the stream is a Whatwg ReadableStream, the chunks in the stream (at least up until n bytes) must be typed arrays (such as e.g. Uint8Array), ArrayBuffers or DataViews.
1import streamHead from 'stream-head' 2 3inputStream; // We get this from somewhere 4 5// Peek the first 64 bytes from the stream. 6const { stream, head } = await streamHead( inputStream, { bytes: 64 } ); 7 8stream; // The new stream (don't use inputStream anymore!) 9head; // A Uint8Array with the first *at least* 64 bytes (or less if the stream was smaller)
In tsconfig.json, lib
needs to include "DOM"
and types
need to include "node"
because this package support both DOM ReadableStream
and Node.js' NodeJS.ReadableStream
type.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More