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

sql-s3

v0.0.5

Published

Stream the contents of arbitrary SQL tables to S3

Readme

sql-s3

Streams arbitrary SQL objects (tables or views) to S3 as delimited files.

Installation

First add the library:

npm install sql-s3 --save

yarn add sql-s3

Then add your database driver:

npm install pg pg-query-stream
npm install sqlite3
npm install mysql
npm install mysql2
npm install oracle
npm install mssql

Usage

Here is an example using environment variables to configure the available options:

const start = Date.now();

const { stream } = require('./index');

const main = async () => {
    try {
        const s = await stream({
            SQL_DIALECT: process.env.SQL_DIALECT, SQL_USER: process.env.SQL_USER, SQL_PASSWORD: process.env.SQL_PASSWORD,
            SQL_HOST: process.env.SQL_HOST, SQL_DATABASE: process.env.SQL_DATABASE, DEBUG: process.env.DEBUG,
            AWS_ACCESS_KEY: process.env.AWS_ACCESS_KEY, AWS_SECRET_KEY: process.env.AWS_SECRET_KEY,
            AWS_REGION: process.env.AWS_REGION, SQL_TABLE: process.env.SQL_TABLE, SQL_SCHEMA: process.env.SQL_SCHEMA,
            COMPRESS: process.env.COMPRESS, BUCKET: process.env.BUCKET, KEY_PREFIX: process.env.KEY_PREFIX
        });
        console.log(s);
    } catch(ex) {
        console.error(ex);
    } finally {
        console.log(`Finished ${process.env.SQL_DATABASE}.${process.env.SQL_SCHEMA}.${process.env.SQL_TABLE} in ${Date.now() - start} ms`);
        process.exit(0);
    }
};
main();

A few notes:

  • KEY_PREFIX can be used to override the database name in the S3 object name. Otherwise the file will be called ${SQL_DATABASE}/${SQL_SCHEMA}/${opts.SQL_TABLE}.csv
  • DEBUG option will log raw queries, row counts and byte flow to stdout
  • COMPRESS option will pass the stream through a Node.js Gzip stream, compressing the results
  • DROP_COLUMNS variable can be used to specify columns to drop (otherwise returns SELECT *). Use a comma-separated list to specify multiple columns.