JSPM

images-upload-middleware

1.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 34
  • Score
    100M100P100Q57909F
  • License MIT

express middleware for images upload

Package Exports

  • images-upload-middleware

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (images-upload-middleware) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

images-upload-middleware

NPM

Express middleware for images upload

Usage

npm i -S images-upload-middleware

Prams

  • savePath: string - path where you want to save images;
  • servePath: string - serve path;
  • multiple: boolean - allows to upload a bunch of images;
  • rename: boolean - if false, then do not rename image default: true;

Examples

import express from 'express';
import imagesUpload from 'images-upload-middleware';

const app = express();

app.use('/static', express.static('./static'));

app.post('/multiple', imagesUpload(
    './static/multipleFiles',
    'http://localhost:8080/static/multipleFiles',
    true
));

app.post('/notmultiple', imagesUpload(
    './static/files',
    'http://localhost:8080/static/files'
));

app.post('/notrename', imagesUpload(
    './static/originalNameFiles',
    'http://localhost:8080/static/originalNameFiles',
    true,
    false
));

app.listen(8080);