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

homer_file_loader

v1.2.0

Published

Homer Code Exercise - Part 1

Downloads

5

Readme

File Loader: A simple command line script to load data from a file into a table in a mysql database. Bulking the records in form of batches.

[![NPM Version][npm-version-image]][npm-url] [![Node.js Version][node-image]][node-url]


Install

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 12+ is required.

Installation is done using the npm install command:

$ npm install homer_file_loader

Or by cloning the repository

$ git clone https://github.com/hamletrp/file_loader.git

Introduction

This is a node.js CLI Script.

Here is how to use it:

There are 2 ways to use this package; As an standalone project/package or as part of another project/package. Next the steps for each case:

As a standalone project/package

  1. Clone the repo [ https://github.com/hamletrp/file_loader.git ]
  2. cd into the cloned repo directory
  3. Install the dependencies
  4. Ensure that the script file has the proper execution permissions, if not, then proceed to provide permissions [ chmod u+x ./file_loader_invoker.js ]
  5. Visualize Package's help and understand it's usage
    • ./file_loader_invoker.js help
    • ./file_loader_invoker.js --help
    • ./file_loader_invoker.js -h
  6. Examples of how to use the script
    • ./file_loader_invoker.js load-file --file --conn-str --table-name
    • ./file_loader_invoker.js load-file --file --conn-str --table-name --batch-size
    • ./file_loader_invoker.js load-file --file --conn-str --table-name --batch-size --has-header <true | false>
    • ./file_loader_invoker.js load-file --file --conn-str --table-name --has-header <true | false>
  7. The script will keep you informed of it's progress via the terminal. It also keeps INFO & ERROR logs in a directory named [logs] placed in the root directory.

As part of another project/package

  1. Install the package [ npm i homer_file_loader ]
  2. Ensure that the script file has the proper execution permissions, if not, then proceed provide permissions [ chmod u+x ./node_modules/homer_file_loader/file_loader_invoker.js ]
  3. Visualize Package's help and understand it's usage
    • ./node_modules/homer_file_loader/file_loader_invoker.js help
    • ./node_modules/homer_file_loader/file_loader_invoker.js --help
    • ./node_modules/homer_file_loader/file_loader_invoker.js -h
  4. Examples of how to use the script
    • ./node_modules/homer_file_loader/file_loader_invoker.js load-file --file --conn-str --table-name
    • ./node_modules/homer_file_loader/file_loader_invoker.js load-file --file --conn-str --table-name --batch-size
    • ./node_modules/homer_file_loader/file_loader_invoker.js load-file --file --conn-str --table-name --batch-size --has-header <true | false>
    • ./file_loader_invoker.js load-file --file --conn-str --table-name --has-header <true | false>
  5. The script will keep you informed of it's progress via the terminal. It also keeps INFO & ERROR logs in a directory named [logs] placed in the root directory.

Additionally

One could place the invokation script as a npm script in the package.json file as usual.

Commandline options

  • --version: Shows the Package's version.
  • --file, -f: The file to be loaded.
  • --conn-str, --cs: The MySQL DB Connection String. Format ["mysql://usr:pwd@host:port/dbname"]'
  • --table-name, --tb: The TableName where to place the data.
  • --batch-size, --bs: Specifies the size of the bulk insert.
  • --has-header, --hh: Specifies if the file has a column header.

Running tests

The test suite only contains a single unit test at the moment. Using Mocha.

Running unit tests

npm test

Running integration tests

To come