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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pluga-plg

v0.2.0

Published

Pluga developer platform toolbox

Readme

pluga-plg

Pluga developer platform toolbox

📦 Setup

  npm install pluga-plg

🔧 Configuration

If you are using the storageService (>= 0.2.0), define the following in the environment:

AWS_S3_BUCKET=bucket-name
AWS_REGION=region
AWS_ACCESS_KEY_ID=access-key
AWS_SECRET_ACCESS_KEY=secret-key

plg.errors

Custom Errors:

There are specific types of errors that are handled differently within the Pluga platform. Details about the supported error types and how they can be used in your code are described below:

  plg.errors.authError(message: String)
  plg.errors.error(message: String)

Errors of this type allow Pluga to process the events automatically at a later time. Should be used when a resource becomes unavailable due to usage limits, for example. You must provide the necessary time (in seconds) for the resource to become available again.

  plg.errors.rateLimitError(message: String, remaining: Integer(seconds))

Temporary or transient errors that may occur due to instabilities, outages, etc., and do not require any manual action for proper functioning. Events with this type of error are automatically reprocessed by the Pluga platform.

  plg.errors.transientError(message: String)

plg.files

plg.files.remote

The files.remote module provides integration with Amazon S3 for file management.

Send a local file to a S3 bucket.

  plg.files.remote.upload({ fileKey: String, filePath: String })

Params

| Name | Type | Required | Description | |----------|--------|-------------|-----------| | fileKey | string | Yes | The unique key (name) for the file in the S3 bucket | | filePath | string | Yes | The local path of the file to upload |

Return

{
  "fileKey": "string"
}

Errors

| type | When it occurs | Example message | |--------------|---------------|-------------------| | Error | Local path does not exist | - | | Error | Internal errors in the AWS SDK | - |

Download a file from an Amazon S3 bucket and save it to a local path.

  plg.files.remote.download({ 
      fileKey: String, 
      pathToWrite: String
      sizeLimit: Number
  })

Params

| Name | Type | Required | Description | |-------------|----------|-------------|-----------| | fileKey | string | Yes | The unique key (name) for the file in the S3 bucket | | pathToWrite | string | Yes | Local path where the downloaded file will be saved | | sizeLimit | number | No | Optional maximum allowed file size in bytes. If exceeded, the download will fail |

Return

{
  "success": true
}

Errors

| type | When it occurs | Example message | |--------------|---------------|-------------------| | Error | Local path does not exist | - | | Error | Internal errors in the AWS SDK | - | | Error | File exceeds size limit specified in the sizeLimit param | File size limit exceeded. File size: ${fileSize} bytes, limit: ${sizeLimit} bytes. |

Generate a temporary signed URL to download a file from S3.

  plg.files.remote.getSignedUrl({ 
      fileKey: String, 
      expiresIn: Number
  })

Params

| Name | Type | Required | Description | |-----------|----------|-------------|-----------| | fileKey | string | Yes | The unique key (name) for the file in the S3 bucket | | expiresIn | number | No | Optional expiration time in seconds. Default: 1800 (30 minutes) |

Return

If the file exists:

{
  "fileKey": "string",
  "signedUrl": "string",
  "expiresIn": "number"
}

If file does not exists returns null

Errors

| type | When it occurs | Example message | |--------------|---------------|-------------------| | Error | Internal errors in the AWS SDK | - |

Checks if a file exists in S3 bucket.

  plg.files.remote.fileExists({ 
      fileKey: String
  })

Params

| Name | Type | Required | Description | |--------|----------|-------------|-----------| | fileKey | string | Yes | The unique key (name) for the file in the S3 bucket |

Retorno

true // if the file exists
false // if the file does not exist

Errors

| type | When it occurs | Example message | |--------------|---------------|-------------------| | Error | Internal errors in the AWS SDK, except for 404, which is treated as false | - |

plg.files.local

The files.local module enables local file handling.

Download a file from a URL as a stream and save it locally.

plg.files.local.downloadStream({
  pathToWrite: String,
  downloadRequestParams: {
    downloadUrl: String,
    headers?: Object,
  },
  callbacks?: {
    onData?: Function,
    onEnd?: Function,
  },
})

Params

| Name | Type | Required | Description | | --------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------- | | pathToWrite | string | Yes | Local path where the downloaded file will be saved. | | downloadRequestParams | object | Yes | Object containing the download URL and optional HTTP headers. | | downloadRequestParams.downloadUrl | string | Yes | Public URL used to download the file. | | downloadRequestParams.headers | object | No | Optional HTTP headers to be sent with the download request. | | callbacks | object | No | Optional callbacks executed during the download lifecycle. | | callbacks.onData | function | No | Executed for each received data chunk. Receives (dataChunk, currentDownloadedBytesCount). | | callbacks.onEnd | function | No | Executed when the download finishes. If it returns a value, the promise resolves with that value. |

Return by default

{
  "success": true
}
  • Note: If onEndCallback returns a value, the promise resolves with that value instead

Errors

| Type | When it occurs | Example | | --------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------- | | Error | Local path to write does not exist or is not writable | — | | Error | Download URL provided is not public or request fails | — | | onDataCallback | Error thrown inside callbacks.onData | { "type": "onDataCallback", "error": <original error> } | | onEndCallback | Error thrown inside callbacks.onEnd | { "type": "onEndCallback", "error": <original error> } | | StreamPipelineError | Stream pipeline fails (connection drop, timeout, write error, etc.) | { "type": "StreamPipelineError", "error": <original error> } |