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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vamtec

v1.3.10

Published

Vamtec is a multi Purpose AI Assistant, ChatBot, file generation (PDF, Excel, CSV), image uploads handling and automation library

Downloads

48

Maintainers

my-universemy-universe

Keywords

image-uploadAIBotGeminiChatBotChatGptAi AssistantAutomationfile-uploadupload-modulefile-managementdirectory-handlermulterexpress-file-uploadfile-storageupload-directoryfile-systemmulter-storageupload-configfile-handlernodejs-uploadfile-upload-handlerexpress-multerfile-upload-serverupload-servicenode-uploadimage-file-uploadtimestamp-filenameoriginal-filenameupload-utilityupload-apifile-upload-apiexpress-uploaddynamic-file-uploadfile-storage-systemfile-directoryupload-directory-creatorfile-saverupload-setupfile-destinationnodejs-storageimage-file-handlerimage-upload-servicefile-organizationfile-saver-nodejsfile-name-handlerupload-optionsupload-folderfile-typenodejs-image-uploadfile-organization-apicustom-file-uploadupload-folder-creatornodejs-file-uploadupload-storage-systemupload-handlerfile-storage-nodefile-directory-managementupload-configurationfile-handler-nodejsexpress-file-handlerupload-file-managerfile-upload-solutionvamtecexpressdynamic-installserver-starternpm-packageexpress-serverexpress-utilitynpm-automationdynamic-setupweb-servernodejsserver-managernpm-deployexpress-toolsauto-installexpress-helpernpm-utilitybackendserverinstallation-toolexpress-setupnpm-package-toolutility-toolwebexpress-managerexpress-scriptsserver-setupserver-utilitynodejs-toolsnodejs-serverexpress-autoautomation-toolnpm-scriptsbackend-toolsexpressjsinstall-dependencyexpress-automationweb-developmentdeveloper-toolsexpress-helper-packagewebserver-packageserver-starter-packagedependency-managernpm-managernode-expressexpress-server-packagenpm-deployment-toolsexpress-startupnodejs-helperweb-server-tools

Readme

Vamtec

Vamtec is a utility package designed to simplify and automate the process of managing commonly used file generation tasks in Node.js. It helps you quickly set up and generate Excel, CSV, and PDF files from JSON data. It also ensures that necessary dependencies like xlsx, json2csv, and pdfkit are installed automatically if missing.

Features

  • Automatically installs necessary dependencies (xlsx, json2csv, pdfkit).
  • Provides functions to generate Excel, CSV, and PDF files from JSON data.
  • Supports quick and seamless file generation for web applications or automation tasks.
  • Lightweight and easy to integrate into existing projects.
  • New Image Upload Module for handling file uploads in multiple ways (automatic folder creation and filename management).

Installation

npm install vamtec

1. Usage ( AI BOT)

# ChatAI Library

Vamtec is a Node.js library that provides an easy-to-use interface to interact with generative AI models, enabling seamless text generation and chatbot functionality. It supports customizable chatbot names and intuitive chat sessions.

---

## Features

- Simple and user-friendly API.
- Text generation powered by the Gemini model.
- Customizable chatbot names.
- Supports multiple exit commands (`exit`, `Exit`, `stop`, `Esc`) for ending the chat.
- Error handling for API requests.

---

## Installation

To install the package, use npm:

```bash
npm install vamtec

Usage

Importing the Library

const { Bot } = require('vamtec');

Example Code

Here’s an example of how to use the ChatAI library:

const { Bot } = require('vamtec');

const apiKey = 'your_api_key_here'; // Replace with your actual API key
const bot = new Bot(apiKey); // Default chatbot name is 'Chatbot'

// Start a chat session
bot.chat();

Renaming the Chatbot

You can rename the chatbot to a custom name before starting the chat session:

const { Bot } = require('vamtec');

const apiKey = 'your_api_key_here'; // Replace with your actual API key
const bot = new Bot(apiKey); // Set a default name ( "ChatBot" ) during initialization

// Rename the chatbot dynamically
bot.rename('MyPersonalBot');

// Start a chat session
bot.chat();

Supported Exit Commands

During a chat session, you can exit the chat by typing any of the following commands:

  • exit
  • Exit
  • stop
  • Esc

API Documentation

Class: Bot

Constructor: new Bot(apiKey)

| Parameter | Type | Default | Description | |-----------|--------|------------|----------------------------------------------| | apiKey | string | Required | Your API key for the Gemini AI model. | | name | string | 'Chatbot'| The name of the chatbot (optional). |

Method: rename(newName)

| Parameter | Type | Description | |------------|--------|----------------------------------------------| | newName | string | The new name for the chatbot. Must be a non-empty string. |

Method: chat()

Starts an interactive chat session. Type messages, and the bot will respond based on the AI model.


Error Handling

If an API request fails, the error message will be displayed, such as:

Chatbot: Sorry, an error occurred: Error occurred while making API request: [error message]

Development

To contribute or customize the package:

  1. Clone the repository.
  2. Install dependencies:
    npm install
  3. Run the library in a local test environment.

Example Output

Default Chat Session

Type one of [exit, Exit, stop, Esc] to end the chat.

You: Hello
Chatbot: Hi there! How can I assist you today?

You: Tell me a joke.
Chatbot: Why don't skeletons fight each other? Because they don't have the guts!

You: exit
Chatbot: Goodbye! 👋

Renamed Chatbot

Type one of [exit, Exit, stop, Esc] to end the chat.

You: Hi
MyPersonalBot: Hello! How can I help you?

You: What is the weather today?
MyPersonalBot: I'm sorry, I can't provide weather updates. Is there anything else you'd like to know?

You: stop
MyPersonalBot: Goodbye! 👋

Automatically Install Dependencies and Load Modules

const vamtec = require('vamtec'); // Import the vamtec library
vamtec.main(); // This will check and install required dependencies like xlsx, json2csv, pdfkit

This will automatically install the required packages and print:

xlsx is already installed.
json2csv is already installed.
pdfkit is already installed.
Modules loaded successfully!
yes...

Using the Functions in Your Express Router

Here’s an example of how to use all three functions (Excel, PDF, and CSV) in an Express route:

Frontend: Reports.js


import React, { useState } from 'react';
import axios from 'axios';
import { DownloadFile } from 'vamtec-react';

const App = () => {
  const [fileFormat, setFileFormat] = useState("excel"); // Default to 'excel' without the dot

  const handleDownload = async () => {
    try {
      const response = await axios.get(`http://localhost:5000/download-leave-requests?format=${fileFormat}`, { responseType: 'blob' });
      // Map 'excel', 'csv', 'pdf' to their respective extensions
      const fileExtension = fileFormat === "excel" ? ".xlsx" : fileFormat === "csv" ? ".csv" : ".pdf";
      // Call the fileHandling function with correct file name and extension
      DownloadFile('Download', fileExtension, response.data); // Pass base filename, extension, and data
    } catch (error) {
      console.error('Error downloading file', error);
    }
  };

  return (
    <div>
      <h1 className="text-2xl font-bold mb-4">Download Leave Requests</h1>
      <select value={fileFormat} onChange={(e) => setFileFormat(e.target.value)} className="p-2 border rounded-md w-full mb-4">
        <option value="excel">Excel (.xlsx)</option>
        <option value="csv">CSV (.csv)</option>
        <option value="pdf">PDF (.pdf)</option>
      </select>
      <button onClick={handleDownload} className="bg-blue-500 text-white p-2 rounded mt-4">
        Download Leave Requests
      </button>
    </div>
  );
};

export default App;

Backend:server.js

const express = require('express');
const router = express.Router();
const vamtec = require('vamtec'); // Import the vamtec library
const pool = require('../config/db'); // Database connection

// Route to generate reports in different formats
router.get('/', async (req, res) => {
  const format = req.query.format || 'excel'; // Default to 'excel' if format is not specified
  const title = req.query.title || 'Leave Requests'; // Get title from query parameter, default to 'Leave Requests Report'
  
  try {
    // Fetch data from the database
    const { rows: data } = await pool.query('SELECT * FROM LeaveRequests');

    // Generate the file based on the format specified in the query
    if (format === 'excel') {
      vamtec.generateExcel(data, res); // Generate Excel file
    } else if (format === 'pdf') {
      vamtec.generatePDF(data, res, title); // Generate PDF file
    } else if (format === 'csv') {
      vamtec.generateCSV(data, res); // Generate CSV file
    } else {
      res.status(400).send('Invalid format');
    }
  } catch (err) {
    console.error('Error:', err);
    res.status(500).send('Internal Server Error');
  }
});

module.exports = router;

Available Functions

  • generateExcel(data, res): Generates and sends an Excel file (XLSX format) from the provided data.
  • generateCSV(data, res): Generates and sends a CSV file from the provided data.
  • generatePDF(data, res, title): Generates and sends a PDF file from the provided data with an optional title.

New Image Upload Module

Vamtec now includes an image upload module for managing file uploads. This module allows flexible folder management and filename control for your file uploads.

Installation

npm install vamtec

Image Upload Setup

Here’s an example of how to use the image upload setup in your Express application:

const express = require("express");
const { img } = require("vamtec"); // Import the image upload setup

const app = express();

// Case 1: Upload with custom folder and filename configuration
app.post("/upload", img({ folder: "uploads1", filename: "timestamp" }).single("image"), async (req, res) => {
  if (!req.file) return res.status(400).send("No file uploaded");
  res.json({ message: "File uploaded successfully", fileName: req.file.filename });
});

// Case 2: Upload with folder and filename array configuration
app.post("/upload", img(["uploads2", "original"]).single("image"), async (req, res) => {
  if (!req.file) return res.status(400).send("No file uploaded");
  res.json({ message: "File uploaded successfully", fileName: req.file.filename });
});

// Case 3: Upload with folder, filename, and field name configuration
app.post("/upload", img(["uploads3", "original", "image"]).single("image"), async (req, res) => {
  if (!req.file) return res.status(400).send("No file uploaded");
  res.json({ message: "File uploaded successfully", fileName: req.file.filename });
});

app.listen(5000, () => console.log("Server running on http://localhost:5000"));

How it Works:

  • Case 1: Uploads a file with a custom folder and filename format (timestamp for a timestamp-based filename).
  • Case 2: Uploads a file with the original filename in the specified folder.
  • Case 3: Uploads a file with a custom folder, filename, and field name (useful when you have multiple fields in your form).

This module supports automatic creation of the upload folder if it doesn't exist.