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 🙏

© 2024 – Pkg Stats / Ryan Hefner

stream-guardian-js

v1.0.1

Published

protects browser streams by writing them into local storage in a recoverable way

Downloads

5

Readme

stream-guardian-js

Stream Guardian JS is a library designed to safeguard streaming content recorded in web browsers. By utilizing the Origin Private File System (OPFS), it ensures that all recorded streams are securely saved locally on the user's device. This system not only protects the recordings but also facilitates the recovery of recorded files, ensuring that your data remains intact and accessible.

Features

  • Secure Recording: Ensures all streaming content is securely recorded in the browser.
  • Local Storage: Utilizes OPFS for saving data locally on the user's device.
  • Data Recovery: Facilitates easy recovery of recorded files.
  • Using web workers: Utilizes web workers to ensure that the recording process does not affect the performance of the main thread.

API

Stream Guardian JS provides an API to interact with the stream recording and management functionalities. Below are the details of the APIs and their usage.

constructor

const streamGuardian = new StreamGuardian({
  stream: stream,
  mimeType: "video/webm;codecs=vp9", // or whatever mime type is appropriate
});

Note: mimeType is optional. If not provided, there is a list of default mime types that will be used based on the browser compatibility.

  • record(): Starts recording the stream.
  • stop(): Stops recording the stream.
  • pause(): Pauses recording the stream.
  • resume(): Resumes recording the stream.
  • blobUrl(): Returns the blob url of the current(on going) recording.
  • listStoredFiles(): Lists all the files stored in the storage:
    • by default files are stored in 'YYYY-MM-DD_HH-MM-SS' format
  • recover(fileName: string): Recovers the file from the storage:
    • fileName: name of the file to be recovered
    • listStoredFiles() can be used to get the list of files stored in the storage

Example

const streamGuardian = new StreamGuardian({
  stream: stream,
  mimeType: "video/webm;codecs=vp9",
});

streamGuardian.record(); // starts recording the stream
streamGuardian.pause(); // pauses recording the stream
streamGuardian.resume(); // resumes recording the stream
streamGuardian.stop(); // stops recording the stream

const recordList: Array<string> = streamGuardian.listStoredFiles(); // lists all the files stored in the storage

streamGuardian.recover(recordList[0]); // recovers the file from the storage

Contributing

Contributions to Stream Guardian JS are always welcome. Whether it's bug fixes, feature enhancements, or documentation improvements, feel free to make a pull request.

License

This project is licensed under MIT License.\