1.0.0 • Published 4 years ago

node-excel-upload v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

excel-upload

A node.js module for uploading and converting excel files into JSON.

Installing

npm install excel-upload

Requirements

Usage

Uploading, storing and parsing files is done asynchronous and the result is returned as a Promise.

Don't forget the enctype="multipart/form-data" in your form.

Browser:

<form action="/upload-documents" method="post" enctype="multipart/form-data">
  <input type="file" name="document" />
</form>

Controller:

import uploadFile from 'excel-upload';
  
static async post(req, res, next) {
 
    const upload = await uploadFile(req, "document-name", "./uploaded", "document");
 
      res.json(upload);
  }

NOTE: Before using excel-upload, make sure you create a corresponding folder in the root where uploaded files will be stored ("./uploaded").

API

KeyDescription
reqreq express.js object
fileNamename of the uploaded file
fileLocationlocation where uploaded file is stored
fieldNamefield name specified in the form

Built With

  • Node - Node.js
  • Multer - Node.js module for upload files

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

1.0.0

4 years ago