Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
then-read-stream
Advanced tools
A promise based asynchronous stream reader.
Allows to read from a Readable Stream similar as you would read from a file.
The then-read-stream
contains one class: StreamReader
. The constructor of
the StreamReader
if provided with the stream.Readable
you want to read from.
import {StreamReader} from "then-read-stream";
const readThisStream = ... // Some stream of type stream.Readable
const streamReader = new StreamReader(readThisStream);
const buf = new Buffer(16);
return streamReader.read(buf, 0, 16).then((bytesRead) => {
// If all went well, buf contains the promised 16 bytes of data read
}).catch((err) => {
if(err === StreamReader.EndOfStream) {
// Rejected, bacause end of the stream has been reached
}
})
var stream_reader = require("then-read-stream");
var readThisStream = ... // Some stream of type stream.Readable
var streamReader = new stream_reader.StreamReader(readThisStream);
return streamReader.read(buf, 0, 16).then( function(bytesRead) {
// If all went well, buf contains the promised 16 bytes of data read
}).catch( function(err) {
if(err === stream_reader.StreamReader.EndOfStream) {
// Rejected, bacause end of the stream has been reached
}
})
FAQs
Read from a readable stream just like a file
We found that then-read-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.