Skip to content

Instantly share code, notes, and snippets.

View Maxtermax's full-sized avatar
🏠
Working from home

Esneyder Amin Maxtermax

🏠
Working from home
View GitHub Profile
//Uploading file directly on mongodb with gridfs-stream and multer express middleware
var multer = require('multer');
var express = require('express');
var mongoose = require('mongoose')
var Grid = require('gridfs-stream');
var conecction = function() {
var conn = mongoose.createConnection('localhost', 'fs_model', 27017).once('open', function() {
console.log('CONECTADO A fs_model');
})//end open connection
//Uploading file directly on mongodb with gridfs-stream and multer express middleware
, multer = require('multer');
var dispatch = function(gfs) {
var stacks = [];//take all files
return multer({
onFileUploadStart:function(file){
stacks.push(gfs.createWriteStream({
filename:file.name,
mode:"w",
chunkSize:1024*4,
//Uploading file directly on mongodb with gridfs-stream and multer express middleware
, multer = require('multer');
var dispatch = function(gfs) {
var stacks = [];//take all files
return multer({
onFileUploadStart:function(file){
stacks.push(gfs.createWriteStream({
filename:file.name,
mode:"w",
chunkSize:1024*4,
//Uploading file directly on mongodb with gridfs-stream and multer express middleware
, multer = require('multer');
var dispatch = function(gfs) {
var stacks = [];//take all files
return multer({
onFileUploadStart:function(file){
stacks.push(gfs.createWriteStream({
filename:file.name,
mode:"w",
chunkSize:1024*4,
//Uploading file directly on mongodb with gridfs-stream and multer express middleware
, multer = require('multer');
var dispatch = function(gfs) {
var stacks = [];//take all files
return multer({
onFileUploadStart:function(file){
stacks.push(gfs.createWriteStream({
filename:file.name,
mode:"w",
chunkSize:1024*4,
//Uploading file directly on mongodb with gridfs-stream and multer express middleware
, multer = require('multer');
var dispatch = function(gfs) {
var stacks = [];//take all files
return multer({
onFileUploadStart:function(file){
stacks.push(gfs.createWriteStream({
filename:file.name,
mode:"w",
chunkSize:1024*4,
@Maxtermax
Maxtermax / <html>
Last active December 18, 2015 16:19
<doctype html>
<head>
<meta charset="utf-8">
<lang="es">
<link rel="stylesheet" type="text/css" href="estilo.css">
<script src="http://code.jquery.com/jquery-2.0.0.min.js"></script>
</head>
<body>
<section>
<div>