1.0.2 • Published 11 months ago

classic-file-uploader v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

CSV/EXcel File Uploader

A fastest Node.js package for processing uploaded CSV or Excel files.

Prerequisites

  • Your file should be CSV or Excel
  • The file must have columns

Example of the file: example.csv

NourlIDOwner
1https://www.example1.comRHA58Dom58
2https://www.example2.comRHA59Dom
3https://www.example1.comRHA60Dom58
4https://www.example3.comRHA61Dom58
5https://www.example1.comRHA62Dom58
6https://www.example3.comRHA63Dom

Installation

npm install classic-file-uploader
pnpm add classic-file-uploader
yarn add classic-file-uploader

Usage in your project

import { FileUploadProcessor } from "classic-file-uploader";

In your controller of somewhere you need to use the Package

const result = await FileUploadProcessor.uploadCsvExcelFile(request as Request)
console.log(result);

Result should be error or data in the file

Sample of the result

Errors

1. When the file is not CSV or Excel file
{
  status: 400,
  error: 'Unsupported file type, file should be CSV/Excel'
}
2. When there is an Internal server error
{
  status: 500,
  error: 'Internal server error'
}

Data response

1. Read all data in CSV or EXCEL file
{
  status: 200,
  message: 'File processed successfully',
   data: [
    { No: 1, url: 'http://example.com', Id: 58 },
    { No: 2, url: 'http://example2.com', Id: 59 },
    { No: 3, url: 'http://example3.com', Id: 60 },
    { No: 4, url: 'http://example4.com', Id: 61 },
    { No: 5, url: 'http://example5.com', Id: 62 },
    { No: 6, url: 'http://example6.com', Id: 63 },
    { No: 7, url: 'http://example.com', Id: 64 },
    { No: 8, url: 'http://example2.com', Id: 65 },
    { No: 9, url: 'http://example3.com', Id: 66 },
    { No: 10, url: 'http://example4.com', Id: 67 },
    { No: 11, url: 'http://example5.com', Id: 68 }
  ]
}
1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago