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

etro-node

v0.1.0

Published

A wrapper to run Etro in Node

Downloads

7

Readme

Etro for Node

Sometimes it's useful to use Etro in Node. This package is a wrapper of Etro that serves that purpose.

Usage

etroNode(() => {
  // You can access inputs as html elements and pass them to Etro as usual.
  const image = document.getElementById('input1') // <img> element
  ...
  movie.exportRaw()
    .then(window.done)
// Tell Etro Node what inputs to load with { id: path }
}, { input1: 'path/to/image.png' }, 'output.mp4')

Documentation

etroNode(etroFunction, inputSources, resultCallbackOrPath[, page])

  • etroFunction (string) - Function to run in the puppeteer page. etro and done are exposed as globals (accessed as properties of window)
    • window.done(exportedBytes) - Process the exported movie (resolved value of Movie#exportRaw), by either writing to resultCallbackOrPath if it's a string or executing it if it's a function
  • inputSources (Object<string, <string|Object>>) - the input assets, mapped from id to path or raw data. If the input is provided as raw data, it should be an object with the following properties:
    • type (string) - the MIME type of the input source
    • data (Buffer)
  • resultCallbackOrPath (function|string) - Determines what to do when window.done is alled in etroFunction. If it's a string, it is treated as a path and the movie is written to it. If it's a function, it is called with one argument exportedBytes.
  • page (Page) - the puppeteer Page to use. Defaults to a page created by a new browser.

Runs etroFunction in a puppeteer page. Each input source is converted to an html element (<img>, <audio> or <video>). The output is either written to the path or the callback is executed, depending on the type of resultCallbackOrPath.

Changelog

0.1.0 - 2020-09-30

Added:

  • etroNode - the etro wrapper
  • Movie#recordRaw - a convenience method for recording in the etro wrapper

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

GPLv3