🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

flowjs-express

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flowjs-express

experimental express 4 flow.js server-side component(s)

0.0.8
latest
npm
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created
Source

FlowJS for Express

This module is experimental - use at own risk - cobbled together from various online sources I've come across.

Code snippet to start with, not that you probably can't copy paste - read it over until I get real documentation.

var temporaryFolder = path.resolve(path.join('./', 'uploads-tmp'));
var flow = require('flowjs-express')(temporaryFolder);
var saveFolder = path.resolve(path.join('./', 'uploads'));

app.post('/uploads', flow.post, function(req, res, next) {
	log.debug('req.flow.status', req.flow.status);
	if (req.flow.status === 'done') {

		// req.flow is populated with great info
		console.log('Upload Done', req.flow);
		
		var file_ext = path.extname(req.flow.filename);
		var save_path = path.join(saveFolder, 'custom-name' + file_ext);

	    var saveStream = fs.createWriteStream(save_path);
	    flow.write(req.flow.identifier, saveStream);

	    saveStream.on('finish', function() {
	    	// file is finished writing
	    	res.send(save_path);

	    }).on('error', function(err) {
	    	res.sendStatus(400);
	    });

	} else {
		res.sendStatus(200);
	}
});

FAQs

Package last updated on 30 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts