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

mbkbucket

v2.1.0

Published

Flexible S3/R2 bucket management library and Express router for mbktech.org applications, providing upload, download, listing, and multipart utilities with built-in configuration validation and health checks

Readme

mbkbucket

S3 Bucket manager for Node.js applications with Express integration.

Version Downloads License Node.js Publish Status

Usage 📖

Installation

Install the package via npm:

npm install mbkbucket

Getting Started

Named imports from package root

import { uploadFile, downloadFile, listfiles, getBucketConfig, packageJson, bucket } from 'mbkbucket';

Default aggregate import

This imports the configured Express server instance:

import mbkbucket from 'mbkbucket';
// Access bucket router via: mbkbucket.bucket

Direct subpath imports (optional)

For more granular control, import directly from submodules:

import { uploadFile } from 'mbkbucket/lib/s3';
import { packageJson } from 'mbkbucket/lib/config/index';
import bucketRouter from 'mbkbucket/lib/bucket';

Additional Information

  • All functions, objects, and variables exported from lib/ are re-exported at the package root for convenience.
  • TypeScript support with full type declarations (index.d.ts) for IDE intellisense and type safety.
  • The default export is the configured Express server instance; access the bucket router as a named export.
  • Supports Node.js 14.0.0 and higher with ES Modules.

API Overview

  • uploadFile() - Upload files to S3 bucket
  • downloadFile() - Retrieve files from S3 bucket
  • listfiles() - List contents of S3 bucket
  • getBucketConfig() - Get current bucket configuration
  • bucket - Express router with bucket management endpoints

For complete API documentation, refer to the TypeScript declarations in index.d.ts.


Requirements

  • Node.js >= 14.0.0
  • AWS S3 credentials configured
  • AWS SDK v3 compatible environment

Environment Configuration

The package validates both mbkbucketVar and BucketConnection at startup.

1 mbkautheVar

mbkautheVar.bucket is used as the default bucket.

Example:

mbkautheVar={"APP_NAME":"portal","loginRedirectURL":"/dashboard","bucket":"R2_Bucket"}

Notes:

  • If APP_NAME is portal, mbkbucket works from bucket root (no portal/ folder prefix).
  • If bucket is missing, mbkbucket falls back to the first bucket key in BucketConnection.

2 BucketConnection

Use a JSON object where each key is a selectable connection name.

Example:

BucketConnection={"R2_Bucket":{"BUCKET_NAME":"my-r2-bucket","ACCESS_KEY_ID":"...","SECRET_ACCESS_KEY":"...","ENDPOINT":"https://<account-id>.r2.cloudflarestorage.com"},"S3_Bucket":{"BUCKET_NAME":"my-s3-bucket","ACCESS_KEY_ID":"...","SECRET_ACCESS_KEY":"...","ENDPOINT":"https://s3.ap-southeast-1.amazonaws.com"}}

Required fields per bucket:

  • BUCKET_NAME
  • ACCESS_KEY_ID
  • SECRET_ACCESS_KEY
  • ENDPOINT

Common Configuration Mistakes

  1. Quoted inner object (invalid)
BucketConnection={"R2_Bucket":"{\"BUCKET_NAME\":\"...\"}"}
  1. Correct inner object (valid)
BucketConnection={"R2_Bucket":{"BUCKET_NAME":"...","ACCESS_KEY_ID":"...","SECRET_ACCESS_KEY":"...","ENDPOINT":"https://..."}}

Runtime Selection

  • Admin page bucket selection: /mbkbucket?bucket=R2_Bucket
  • Public view route /mbkbucket/p_view/:key(*) always uses the default bucket from mbkautheVar.bucket.

Automated Tests

Run tests:

npm test

Current tests cover:

  • mbkbucketVar parsing/defaults/boolean normalization
  • BucketConnection shape validation and required fields

Contact & Support

For questions, issues, or contributions, please reach out:


About

Developed by Muhammad Bin Khalid
Part of MBK Tech Studio


License

Licensed under the GPL-2.0 License. See LICENSE file for details.