Fast File is a quick and easy-to-use library to convert data sources to a variety of options.

Overview

Fast File Converter

The Express.js's Fast File Converter Library

download-image

Ali-A-Koye - fast-file License

Fast File Converter Library is a quick and easy-to-use library to convert data sources to a variety of options. Fast File tries to make the developer's life easier by simplifying many conversion options (PDF, JSON, CSV, imSQL, text, excel, and Docx) with a single data source format.

Making the developer's life easier

Our idea for this package is to provide the basic needs of a developer when dealing with files simply.
When you only have a result of a query ( Array of Objects ) and you want to convert it to a form that a non-programmer can read and understand more easily, that's how our package helps you to convert your data into a variety of data representation forms just by calling one function.
 

Key Features

  • Easy to use.
  • Sending the response back to the client and completes the request-response cycle by itself
  • Files that have been generated will be sent back to the client as a stream, ensuring that a large amount of data can be transferred easily.
  • Option to rename the Headers for the data representation in table form.
  • Supports  PDF, JSON, CSV, imSQL, text, excel, and Docx.
  • Package built with Typescript, you will get the Typescript benefits of validation of your data if you already use Typescript. 

Table of Contents

Demo

This is a simple Demo environment for the package where you can use and test the package , clone it and it's simple express.js with TS application that is integrated with this package.

Work with the Demo instruction :

npm install  // Installing dependencies
npm run build  // To build the TS into JS code
npm run start // To start the express.js server

Requirements

In order to work with this package, you are required to :

  • install node.js and npm
  • install expres.js as your project must be express.js

Installation

To use the package you must first add the it to your dependencies in your project.

$ npm i fast-file-converter

Then you have to register the package in your project.

Typescript

import fastFile from "fast-file-converter";

Javascript

const fastFile = require("fast-file-converter").default;

Usage

With our aim for simplicity of this package, the integration part is the easiest and we will demonstrate it below.
 

PDF 

You can convert your array of an object into a nice, pre-styled table and have it downloaded right away, as simple as this : 

app.get("/pdf", (req, res) => {
  let data = [
    { name: "Ali", age: 23},
    { name: "Alison", age: 20 },
  ];
  fastFile(data, "pdf", res); //This will end the request as well.
});

DocX

You can convert your array of an object into a pre-configured table and have it downloaded right away, the benefit of this is that you can style it the way you want after downloading the docx.

app.get("/docx", (req, res) => {
  let data = [
    { name: "Ali", age: 23},
    { name: "Alison", age: 20 },
  ];
  fastFile(data, "docx", res);  //This will end the request as well.
});

Excel / XLSX

You can convert your array of an object into a nice, pre-styled Excel file and have it downloaded right away, as simple as this : 
 

app.get("/excel", (req, res) => {
  let data = [
    { name: "Ali", age: 23},
    { name: "Alison", age: 20 },
  ];
  fastFile(data, "excel", res); //This will end the request as well.
});

CSV

You can convert your array of an object into a CSV file and have it downloaded right away, as simple as this : 
 

app.get("/csv", (req, res) => {
  let data = [
    { name: "Ali", age: 23},
    { name: "Alison", age: 20 }, 
  ];
  fastFile(data, "csv", res); //This will end the request as well.
});

Text 

You can convert your array of an object into a readable .txt file and have it downloaded right away, as simple as this : 

app.get("/txt", (req, res) => {
  let data = [
      { name: "Ali", age: 23},
      { name: "Alison", age: 20 }, 
  ];
  fastFile(data, "txt", res); //This will end the request as well.
});

imSql ( insert Many SQL ) 

You can convert your array of an object into an insert many format of SQL file and have it downloaded right away, as simple as this : 
 

app.get("/imSql", (req, res) => {
  let data = [
      { name: "Ali", age: 23},
      { name: "Alison", age: 20 }, 
  ];
  fastFile(data, "imSql", res); //This will end the request as well.
});

JSON

You can convert your array of an object into an JSON format and have it downloaded right away, as simple as this : 

app.get("/json", (req, res) => {
  let data = [
      { name: "Ali", age: 23},
      { name: "Alison", age: 20 }, 
  ];
  fastFile(data, "json", res); //This will end the request as well.
});

AsOp (As Operation) Configuration :

AsOp is an array of objects, for which columns you want to have which field in your data, and which header for it. that means you can easily control the flow of your data by specifying a friendly name as a header and specifying the corresponding field with it.
 

app.get("/pdf", (req, res) => {
  let data = [
    { name: "Ali", age: 23},
    { name: "Alison", age: 20 },
  ];
  
 let asOp = [
   {
       field:"name" //field which points to a field in data array of object
       as:"Full Name of Employees"  //as is column header
   }
 ];
 
  fastFile(data, "pdf", res , asOp); //This will end the request as well.
});

With above example, you will get a table which has "Full Name of Employee" as header and the whole column is filled with names
 

API

Below is a table of acceptable parameters for this library.

Parameter Description Default Validations
data Array of Objects   Required
Type must be valid Enum ("pdf" , "excel" , "docx" , "csv" , "txt" ,"imSql" , “json” )   Required
response Express.js's Response Object   Required
AsOp As Operation is an Array of Objects []  

Author

Ali Amjed

License

The MIT License

You might also like...

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.

Please use version 1.x as prior versions has a security flaw if you use user generated data to concat your SQL strings instead of providing them as a

Jan 9, 2023

Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.

Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.

Azure Data Studio is a data management tool that enables working with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.

Dec 31, 2022

NodeDomainScrape - Use puppeteer to catch the data from domain.com.au

nodeDomainScrape 1 install node (https://nodejs.org/en/) and download the code; 2 run npm install in the terminal; 3 go to "https://www.domain.com.au/

Jan 2, 2022

Fast and advanced, document based and key-value based NoSQL database that able to work as it is installed.

Fast and advanced, document based and key-value based NoSQL database that able to work as it is installed.

About Fast and advanced, document based and key-value based NoSQL database that able to work as it is installed. Features NoSQL database Can be run as

Dec 7, 2022

Fast and advanced, document-based and key-value-based NoSQL database.

Fast and advanced, document-based and key-value-based NoSQL database.

Contents About Features Installation Links About Fast and advanced, document-based and key-value-based NoSQL database. Features NoSQL database Can be

Dec 7, 2022

Simple, buffered, line-by-line file reader with customizable buffer size.

simple-line-reader Simple, buffered, line-by-line file reader with customizable buffer size. Install npm install simple-line-reader yarn add simple-li

Jan 15, 2022

Display tsc errors count on file tree.

Display tsc errors count on file tree.

tsc-err-dirs 中文文档 Display tsc errors count on file tree, can hot update when you change those files. Screeshot Requirement node version: =16 tsc vers

Nov 18, 2022

Database in JSON, fast and optimize

📍 Database-Dev 🔧 DevNetwork#2103 🔖 V 1.0.0 📚 Dependence Libs use 💎 NodeJs V 16.14.2 (NodeJs) 💎 fs (nodeFS) 💻 Use libs import the file in your p

Apr 21, 2022

A fast, synchronized and dynamic query builder package.

A fast, synchronized and dynamic query builder package.

@ssibrahimbas/query A fast, synchronized and dynamic query builder package. What is? In short, the query builder. You can write complex and parameteri

Jun 13, 2022
Comments
  • Use the real NPM package version in the demo folder instead of the local library version

    Use the real NPM package version in the demo folder instead of the local library version

    Hello ali ✋, Good job with this really amazing package.

    There was an issue that came up to me when trying to clone the demo folder and run it for the very first time. It was raising this error: Error: Cannot find module 'pdfmake In which i believe it's a dependency being used by the package itself.

    The issue was that the demo folder is importing the local version of the the package in the root directory, in which it doesn't exists as people will try to only copy/clone the demo folder for quick use cases, so i believe it's a much better practice to have the real npm version of the package there instead of the local, and keeping it up to date.

    Best.

    good first issue 
    opened by peshanghiwa 0
  • Native nodejs support?

    Native nodejs support?

    Hi ali,

    I was trying to use the package alongside with fastify and it didn't work. It seems that the package is built on top of expressjs and only works with express. So i was wondering if it's possible to add full native nodejs support to the package.

    Best.

    enhancement 
    opened by peshanghiwa 1
Releases(v1.0.7)
Owner
Ali Amjad
Software Engineer | Full Stack Developer | Professional Back-End Developer | Problem Solver
Ali Amjad
A JSON Database that saves your Json data in a file and makes it easy for you to perform CRUD operations.

What is dbcopycat A JSON Database that saves your Json data in a file and makes it easy for you to perform CRUD operations. ⚡️ Abilities Creates the f

İsmail Can Karataş 13 Jan 8, 2023
Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.

Lovefield Lovefield is a relational database written in pure JavaScript. It provides SQL-like syntax and works cross-browser (currently supporting Chr

Google 6.8k Jan 3, 2023
a Node.JS script to auto-import USB drives that are attached to a computer. Use it to turn your NAS into a smart photo / file importer.

File Vacuum 5000 ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ WARNING: This script is designed to manipulate files on both an external drive and another specif

null 46 Jan 10, 2022
An easy-to-use discord bot including database, slash commands and context menus !

Discord Bot Template An easy-to-use discord bot using Discord.JS V13. Wiki Includes: Slash commands Database User commands and more in future Requirem

Gonz 108 Dec 28, 2022
⛰ "core" is the core component package of vodyani, providing easy-to-use methods and AOP implementations.

Vodyani core ⛰ "core" is the core component package of vodyani, providing easy-to-use methods and AOP implementations. Installation npm install @vodya

Vodyani 25 Oct 18, 2022
An easy-to-use multi SQL dialect ORM tool for Node.js

Sequelize Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. It features solid transaction s

Sequelize 27.3k Jan 4, 2023
A proposal to add modern, easy to use binary encoders to the web platform.

proposal-binary-encoding A proposal to add modern, easy to use binary encoders to the web platform. This is proposed as an addition to the HTML spec,

Luca Casonato 35 Nov 27, 2022
graphql-codegen plugin to generate type-safe, easy-to use hooks for Flutter

graphql-codegen-flutter-artemis-hooks This is graphql-codegen plugin to generate type-safe, easy-to use Flutter artemis hooks. For further detail, see

seya 18 Jan 2, 2023
A simple easy-to-use database, built for beginners.

ByteDatabase: Built for Beginners Table of Content Features Installation Changelog Quick Examples Contributors Features Persistent Storage: Data store

CloudTeam 9 Nov 20, 2022
A database library stores JSON file for Node.js.

concisedb English | 简体中文 A database library stores JSON file for Node.js. Here is what updated every version if you want to know. API Document Usage B

LKZ烂裤子 3 Sep 4, 2022