express-fileupload
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "express-fileupload", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Richard Girges <richardgirges@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Simple express file upload middleware that wraps around Busboy", |
# express-fileupload | ||
Simple express middleware for uploading files. | ||
[![npm Package](https://img.shields.io/npm/v/express-fileupload.svg?style=flat-square)](https://www.npmjs.org/package/express-fileupload) | ||
[![npm](https://img.shields.io/npm/v/express-fileupload.svg)](https://www.npmjs.org/package/express-fileupload) | ||
[![Build Status](https://travis-ci.org/richardgirges/express-fileupload.svg?branch=master)](https://travis-ci.org/richardgirges/express-fileupload) | ||
@@ -9,5 +9,5 @@ [![downloads per month](http://img.shields.io/npm/dm/express-fileupload.svg)](https://www.npmjs.org/package/express-fileupload) | ||
# Version 0.1.0 Breaking Changes | ||
# Version 0.1.0 Breaking Changes! | ||
## BREAKING CHANGE: No more urlencoded support | ||
#### » No more urlencoded support | ||
As of `v0.1.0`, there is NO MORE `application/x-www-form-urlencoded` SUPPORT! Moving forward, express-fileupload is considered a "multipart" solution only. | ||
@@ -17,4 +17,4 @@ | ||
## BREAKING CHANGE: Official support for Node v4.x.x + | ||
Use with lower versions of Node at your own risk! | ||
#### » No more support for < Node.js v4 | ||
No more support for versions of Node older than v4. Use with lower versions of Node at your own risk! | ||
@@ -51,5 +51,5 @@ # Install | ||
```javascript | ||
var express = require('express'); | ||
var fileUpload = require('express-fileupload'); | ||
var app = express(); | ||
const express = require('express'); | ||
const fileUpload = require('express-fileupload'); | ||
const app = express(); | ||
@@ -60,20 +60,14 @@ // default options | ||
app.post('/upload', function(req, res) { | ||
var sampleFile; | ||
if (!req.files) | ||
return res.status(400).send('No files were uploaded.'); | ||
if (!req.files) { | ||
res.send('No files were uploaded.'); | ||
return; | ||
} | ||
// The name of the input field (i.e. "sampleFile") is used to retrieve the uploaded file | ||
sampleFile = req.files.sampleFile; | ||
let sampleFile = req.files.sampleFile; | ||
// Use the mv() method to place the file somewhere on your server | ||
sampleFile.mv('/somewhere/on/your/server/filename.jpg', function(err) { | ||
if (err) { | ||
res.status(500).send(err); | ||
} | ||
else { | ||
res.send('File uploaded!'); | ||
} | ||
if (err) | ||
return res.status(500).send(err); | ||
res.send('File uploaded!'); | ||
}); | ||
@@ -80,0 +74,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
776001
130