npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@judeoscar/streamify

v1.0.1

Published

A custom node js stream cli tool.

Downloads

4

Readme

Streamify

Streamify is a Node.js-based library that provides tools to handle streaming operations with custom-readable and writable streams. The library is designed for efficiently reading and writing large files in chunks, with support for specifying byte ranges to extract specific parts of a file.


Features

  • Custom Readable Stream: Read files chunk by chunk with support for specifying byte ranges.
  • Custom Writable Stream: Write data to files in an efficient, memory-managed manner.
  • Flexible Integration: Designed to work with any file type, including text, audio, and video files.
  • Error Handling: Provides comprehensive error management for readable and writable streams.

Installation

To use Streamify, clone the repository and include it in your Node.js project:

# Clone the repository
git clone https://github.com/securestackdev/streamify.git

# Navigate to the project directory
cd streamify

# Install dependencies
npm install

Usage

Import the Library

const { ReadableStream } = require("./lib/readable");
const { WritableStream } = require("./lib/writable");

Example: Copying a File

const inputFile = "./test/input.txt";
const outputFile = "./test/output.txt";
const chunkSize = 1024; // 1KB
const startByte = 0;
const endByte = 2048; // 2KB

(async () => {
  try {
    await ReadableStream(
      inputFile,
      outputFile,
      chunkSize,
      startByte,
      endByte,
      WritableStream
    );
    console.log("File copied successfully!");
  } catch (error) {
    console.error("Error:", error.message);
  }
})();

API Reference

FileReadableStream

A custom readable stream for reading files in chunks.

Constructor Options:

  • highWaterMark (number): The size (in bytes) of the internal buffer.
  • fileName (string): The path to the input file.
  • startByte (number): The byte to start reading from.
  • endByte (number): The byte to stop reading at.

Methods:

  • _construct(callback): Opens the file for reading.
  • _read(size): Reads a chunk of data from the file.
  • _destroy(error, callback): Closes the file and cleans up resources.

FileWritableStream

A custom writable stream for writing files in chunks.

Constructor Options:

  • highWaterMark (number): The size (in bytes) of the internal buffer.
  • outputFile (string): The path to the output file.

Methods:

  • _construct(callback): Opens the file for writing.
  • _write(chunk, encoding, callback): Writes a chunk of data to the file.
  • _final(callback): Writes any remaining data before closing the file.
  • _destroy(error, callback): Closes the file and cleans up resources.

Supported Use Cases

  • File Copying: Transfer data from one file to another.
  • File Trimming: Extract specific parts of a file (e.g., audio or video segments).
  • Large File Handling: Efficiently process files that cannot fit into memory.

Error Handling

Both ReadableStream and WritableStream include error handling via event listeners:

stream.on("error", (err) => {
  console.error("Stream error:", err);
});

Contributing

Streamify is an open-source project. Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -m 'Add feature-name'
  4. Push to the branch: git push origin feature-name
  5. Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

  • Inspired by Node.js streams documentation.
  • Thanks to the developer community for feedback and contributions.